How to do a cycle in the graph each time of plot
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello :)
How to make a cyclic graph every time the same data start at a certain point as in the first mode just subtract the original.
Or have a special code offer for it.
I want similar as in the picture here.
For example, at theta= 90 I want to start as original at angle 0 to all calculations. In this case need to subtract 90 each time.
Too after theta= 180 subtract 180 each time.
Thanks for the helpers
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/843815/image.png)
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')
title('The components of the forces as a function of the angle of chip in the milling');
xlabel('theta [deg]');
ylabel('Force [N]');
0 commentaires
Réponse acceptée
Walter Roberson
le 25 Déc 2021
K_t=750;
K_r=250;
b=5;
f_z=0.1;
theta=0:360 ;
for i = 1: length(theta)
t90 = mod(theta(i), 90);
if (t90 >= 60 & t90 <= 90)
F_x(i)=0;
F_y(i)=0;
F(i)=0;
else
st90 = sind(t90);
ct90 = cosd(t90);
h_cut = f_z * st90;
F_r=K_r*b*h_cut;
F_t=K_t*b*h_cut;
F_x(i) = abs(-F_t .* ct90 - F_r .* st90);
F_y(i) = F_t .* st90 - F_r .* ct90;
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')
title('The components of the forces as a function of the angle of chip in the milling');
xlabel('theta [deg]');
ylabel('Force [N]');
2 commentaires
Plus de réponses (1)
DGM
le 25 Déc 2021
Modifié(e) : DGM
le 25 Déc 2021
You can use mod() and simple masking to avoid the loop and conditional.
K_t = 750;
K_r = 250;
b = 5;
f_z = 0.1;
theta = 0:360;
qtcycle = mod(theta,90);
sqc = sind(qtcycle);
cqc = cosd(qtcycle);
mask = qtcycle<=60;
h_cut = f_z*sin(qtcycle*pi/180);
F_r = K_r*b*h_cut;
F_t = K_t*b*h_cut;
F_x = abs(-F_t.*cqc - F_r.*sqc).*mask;
F_y = (F_t.*sqc - F_r.*cqc).*mask;
F = sqrt(F_x.^2 + F_y.^2).*mask;
plot(theta,F_x,'--r',theta,F_y,'--b',theta,F,'k' )
legend('F_x' ,'F_y','F')
title('The components of the forces as a function of the angle of chip in the milling');
xlabel('theta [deg]');
ylabel('Force [N]');
2 commentaires
Walter Roberson
le 25 Déc 2021
ylim([0 350])
Note however that your F_y values to go about -10.4
Voir également
Catégories
En savoir plus sur Line Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!