How to plot two variables of a function having four variables?

I have a function
f = equv_sigma-Yref==0
with
equv_sigma= ( (a*(r+w)^(2*k)) + (a*(r-w)^(2*k)) + ((1-a)*(2*A)^(2*k)) )^(1/(2*k));
with 3 terms
r=(i+M*j)/2;
w=sqrt((((N*i-P*j)^2)/4)+ ((Q^2)*ii*jj) );
A=sqrt((((R*i-S*j)^2)/4)+ ((T^2)*ii*jj) );
with the following constants
a=0.543404;
M=1.093992;
N=1.018431;
P=0.972750;
Q=1.045567;
R=0.988196;
S=1.040132;
T=1.004799;
k=4;
Yref=142;
===========================
what I want is to plot the i and j values, so could you please help me? I HAVE TRIED TO PRODUCE THE i and j VALUES BUT NO CHANCE SICNE THE NESTED LOOP ARE HUGE.
=====================================
clear all
x=0;
y=0;
counter=0;
a=0.543404;
M=1.093992;
N=1.018431;
P=0.972750;
Q=1.045567;
R=0.988196;
S=1.040132;
T=1.004799;
k=4;
Yref=142;
for i=-150:0.01:-150 & 150:0.01:150
for j=-150:0.01:-150 & 150:0.01:150
r=(i+M*j)/2;
for ii=-150:0.01:-150 & 150:0.01:150
for jj=-150:0.01:-150 & 150:0.01:150
w=sqrt((((N*i-P*j)^2)/4)+ ((Q^2)*ii*jj) );
A=sqrt((((R*i-S*j)^2)/4)+ ((T^2)*ii*jj) );
equv_sigma= ( (a*(r+w)^(2*k)) + (a*(r-w)^(2*k)) + ((1-a)*(2*A)^(2*k)) )^(1/(2*k));
if equv_sigma-Yref==0
counter=counter+1;
x(counter)=i;
y(counter)=j;
end
end
end
end
end

回答(1 个)

sorry I made a mistake , this is the code I have tried clear all
x=0; y=0; counter=0; a=0.543404; M=1.093992; N=1.018431; P=0.972750; Q=1.045567; R=0.988196; S=1.040132; T=1.004799; k=4; Yref=142;
for i=-150:0.0001:150 for j=-150:0.0001:150 r=(i+M*j)/2; for ii=-150:0.0001:150 for jj=-150:0.0001:150 w=sqrt((((N*i-P*j)^2)/4)+ ((Q^2)*ii*jj) ); A=sqrt((((R*i-S*j)^2)/4)+ ((T^2)*ii*jj) ); equv_sigma= ( (a*(r+w)^(2*k)) + (a*(r-w)^(2*k)) + ((1-a)*(2*A)^(2*k)) )^(1/(2*k)); if equv_sigma-Yref==0 counter=counter+1; x(counter)=i; y(counter)=j; end end end
end
end

类别

帮助中心File Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by