How to solve error in executing for loop due to Solve command used?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
angle=90;
theta=angle*pi/180;
m=cos(theta);
n=sin(theta);
%Sig1=Sigx*m^2+Sigy*n^2+2*m*n*Sigxy;
%Sig2=Sigx*n^2+Sigy*m^2-2*m*n*Sigxy;
%Sig6=Sigx*m*n+Sigy*n*m+(m*m-n*n)*Sigxy;
S1=1500;
S2=40;
S6=68;
for z=1:1500
Sigx(z)=z;
Sy=solve('(((z*m^2+Sigy*n^2)^2/(S1*S1))+((z*n^2+Sigy*m^2)^2/(S2*S2))+((z*m*n+Sigy*n*m)^2/(S6*S6))-(((z*m^2+Sigy*n^2)*(z*n^2+Sigy*m^2))/(S1*S1))=1)');
Sigy(z)=Sy;
end
plot(Sigx, Sigy);
There is error in executing solve command....How to solve this?
1 Commento
Risposta accettata
Walter Roberson
il 1 Apr 2013
Please note that when you use a quoted string as the argument to solve, then variables you have defined at the MATLAB level are not given those values for the purposes of solve(): they are treated as symbolic variables with unknown values. Then, because you have not indicated which of the symbolic variables to solve for, solve will try to solve for all of them and will fail because there are not enough equations to solve them simultaneously.
My guess at what you are trying to do is:
syms Sigy
for z=1:1500
Sigx(z)=z;
Sy(z) = solve( (((z*m^2+Sigy*n^2)^2/(S1*S1))+((z*n^2+Sigy*m^2)^2/(S2*S2))+((z*m*n+Sigy*n*m)^2/(S6*S6))-(((z*m^2+Sigy*n^2)*(z*n^2+Sigy*m^2))/(S1*S1))-1), Sigy);
end
Sigy = double(Sy);
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!