graphical solution to plot the transcendental eauation-Array indices must be positive integers or logical values.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
for the transcendental eauation to be like this-->
I want to plot the figure above .
PHI is a matrix , it will chamge its value as our other values change.
like the following
PHI(:,1)=V(:,xsteps-0);
PHI(:,2)=V(:,xsteps-1);
PHI(:,3)=V(:,xsteps-2);
----------------------------------------------------------------
the code downside is the problem
the system tell me that
"Array indices must be positive integers or logical values."
Error in this line --> sin(PHI)=linspace(0,lambda/(4*n1*W/2),sqrt(2*delta))
can anyone help me plot this figure or tell me how to fix my code?
----------------------------------------------------------------
【this is my main code】
for m=0:8
sin(PHI)=linspace(0,lambda/(4*n1*W/2),sqrt(2*delta));
plot(sin(PHI),(atan(sqrt(2*delta./(sin(PHI).^2)-1))+m*pi/2)/(ko*n1*(W/2)))
ylim([0 10])
end
-----------------------------------
1 Kommentar
Jeffrey Clark
am 16 Okt. 2022
@御方 羅, you can't have a function reference on the left side of the equals and you should not use function names as variable names if sin(PHI) is your variable array name and index. Since you are getting the error "Array indices must be positive integers or logical values" I suspect you want:
PHI = linspace(0,lambda/(4*n1*W/2),sqrt(2*delta));
Antworten (1)
Mann Baidi
am 7 Sep. 2023
Hi,
I understand you would like to plot “sin(PHI)” vs “atan()” graph and you are facing issue in assigning values to “PHI”. This is because you cannot assign values to a function in MATLAB. If you want to assign value to “PHI” the correct syntax would be
PHI = linspace(0,lambda/(4*n1*W/2),sqrt(2*delta));
Or if you would like to use the equation as
PHI=sin-1(linspace(0,lambda/(4*n1*W/2),sqrt(2*delta)
You can use the “asin” function.
PHI=asin(linspace(0,lambda/(4*n1*W/2),sqrt(2*delta)));
For more information on the "asin" function, you can refer to the following documentation:
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Dialog Boxes finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!