how to solve and plot complex equation
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Heather
el 12 de Feb. de 2024
Editada: Walter Roberson
el 12 de Feb. de 2024
Trying to plot the bottom equation where x is 0-180 degrees. I believe the sin within the [] of the sin is where I'm messing up.
a=(b*Pi*sin(x))/c
b and c are constants
x=0-180 degrees
y=(sin^2(a))/a^2
0 comentarios
Respuesta aceptada
VBBV
el 12 de Feb. de 2024
b = 3; c = 4;
x=0:180;
a=b*pi*sin(deg2rad(x))/c;
y=(sin(a).^2)./a.^2;
plot(x,y)
Más respuestas (1)
Austin M. Weber
el 12 de Feb. de 2024
Editada: Austin M. Weber
el 12 de Feb. de 2024
A couple of things: pi needs to be lowercase and you need to use .*, ./, and .^ when doing element-wise operations on vectors or matrices. I hope this helps!
a = 2;
b = 3;
c = 4;
x=0:180;
a=(b*pi*sin(x)) ./c;
y=(sin(a).^2) ./ a.^2;
plot(x,y)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!