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

1 visualización (últimos 30 días)
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)

Respuesta aceptada

Simon Chan
Simon Chan el 30 de Mzo. de 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)

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by