Getting Complex numbers for a (2equation+2unknown)

1 次查看(过去 30 天)
Hi All
I am wondering why I am getting complex numbers for this code, any help would be really appreciated.
clear
clc
close all
syms sigma a
a0=0.01;
w=0.05;
% defining the equations
F=0.265*(1-(a/w))^4 +(0.857+0.265*(a/w))*((1-(a/w))^(-3/2));
Kapp=sigma*sqrt(3.14*a)*F;
KC=110000000;
KR=KC*(4-3*exp(-(a-a0)/0.003));
diffKapp = diff(Kapp,a)
diffKR = diff(KR,a)
%solving the equations
[S, avalue] = solve([Kapp == KR, diffKapp == diffKR], [sigma, a])
double(S)
double (avalue)

采纳的回答

Philip Caplan
Philip Caplan 2015-4-29
You can ensure 'sigma' and 'a' are treated as real variables by declaring them slightly differently. Instead of
syms sigma a
please use
sigma = sym('sigma','real');
a = sym('a','real');
For more information on setting assumptions for symbolic variables, please see
  1 个评论
Sia
Sia 2015-4-29
Thanks man, the problem is my equations were not linear and I had to use iteration to solve it ;)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by