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

1 visualización (últimos 30 días)
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)
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

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
sigma = sym('sigma','real');
a = sym('a','real');
For more information on setting assumptions for symbolic variables, please see
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
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.

### Categorías

Más información sobre Calculus en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by