Why am i getting 'Array indices must be positive integers or logical values" when trying to plot this function?

1 Ansicht (letzte 30 Tage)
x1=linspace(asind(1/1.4),90,100)
% Defining functions for M = 1.4, alpha (a) = 1.4
f1(x1)=2*cotd(x1).*(1.4^2.*(sind(x1)).^2-1)./(1.4^2.*(1.4+cosd(2.*x1))+2)-tand(4)
f2(x1)=2*cotd(x1).*(1.4^2.*(sind(x1)).^2-1)./(1.4^2.*(1.4+cosd(2.*x1))+2)-tand(8)
f3(x1)=2*cotd(x1).*(1.4^2.*(sind(x1)).^2-1)./(1.4^2.*(1.4+cosd(2.*x1))+2)-tand(12)

Akzeptierte Antwort

Simon Chan
Simon Chan am 30 Mär. 2022
Remove the x1, otherwise it becomes the index of the varaibles f1,f2 & f3 where index must be a positive integers. That's why you get an error
f1=2*cotd(x1).*(1.4^2.*(sind(x1)).^2-1)./(1.4^2.*(1.4+cosd(2.*x1))+2)-tand(4)
f2=2*cotd(x1).*(1.4^2.*(sind(x1)).^2-1)./(1.4^2.*(1.4+cosd(2.*x1))+2)-tand(8)
f3=2*cotd(x1).*(1.4^2.*(sind(x1)).^2-1)./(1.4^2.*(1.4+cosd(2.*x1))+2)-tand(12)

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by