フィルターのクリア

How to solve error in executing for loop due to Solve command used?

1 回表示 (過去 30 日間)
Shantanu K
Shantanu K 2013 年 4 月 1 日
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 件のコメント
Walter Roberson
Walter Roberson 2013 年 4 月 1 日
What error do you see in the solve command?

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2013 年 4 月 1 日
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 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by