How to arrange with the graph

조회 수: 1 (최근 30일)
Emilia
Emilia 2021년 12월 24일
댓글: Emilia 2021년 12월 25일
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

채택된 답변

VBBV
VBBV 2021년 12월 25일
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')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by