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)
0 个评论
采纳的回答
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!