Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
Sia
Sia el 28 de Abr. de 2015
Comentada: Sia el 29 de Abr. de 2015
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)

Respuesta aceptada

Philip Caplan
Philip Caplan el 29 de Abr. de 2015
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 comentario
Sia
Sia el 29 de Abr. de 2015
Thanks man, the problem is my equations were not linear and I had to use iteration to solve it ;)

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by