How to arrange with the graph

2 visualizaciones (últimos 30 días)
Emilia
Emilia el 24 de Dic. de 2021
Comentada: Emilia el 25 de Dic. de 2021
Hello :)
I need help creating a graph. I wrote in the theta code ranges to be zeros also in the y-axis, and other numbers to get just like this graph.
Thanks in advance
clc;
clear;
K_t=750;
K_r=250;
b=5;
f_z=0.1;
theta=0:360 ;
if theta==60:90 && theta==150:180 && theta==240:270
F_x=0;
F_y=0;
F=0;
else
h_cut=f_z*sin(theta*pi/180);
F_r=K_r*b*h_cut;
F_t=K_t*b*h_cut;
F_x=abs(-F_t.*cos(theta.*pi/180)-F_r.*sin(theta.*pi/180));
F_y=F_t.*sin(theta.*pi/180)-F_r.*cos(theta.*pi/180);
F=sqrt((F_x).^2+(F_y).^2);
plot(theta,F_x,'--r',theta,F_y,'--b',theta,F,'k' )
legend({'F_x' ,'F_y','F'})
end

Respuesta aceptada

VBBV
VBBV el 25 de Dic. de 2021
clc;
clear;
K_t=750;
K_r=250;
b=5;
f_z=0.1;
theta=0:360 ;
for i = 1: length(theta)
if (theta(i) >= 60 & theta(i) <= 90) || (theta(i) >= 150 & theta(i) <= 180) || (theta(i) >= 240 & theta(i) <= 270)
F_x(i)=0;
F_y(i)=0;
F(i)=0;
else
h_cut=f_z*sin(theta(i)*pi/180);
F_r=K_r*b*h_cut;
F_t=K_t*b*h_cut;
F_x(i)=abs(-F_t.*cos(theta(i).*pi/180)-F_r.*sin(theta(i).*pi/180));
F_y(i)=F_t.*sin(theta(i).*pi/180)-F_r.*cos(theta(i).*pi/180);
F(i)=sqrt((F_x(i)).^2+(F_y(i)).^2);
end
end
plot(theta,F_x,'--r',theta,F_y,'--b',theta,F,'k' )
legend('F_x' ,'F_y','F')

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by