How to do a cycle in the graph each time of plot
Show older comments
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

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]');
Accepted Answer
More Answers (1)
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 Comments
Emilia
on 25 Dec 2021
Walter Roberson
on 25 Dec 2021
ylim([0 350])
Note however that your F_y values to go about -10.4
Categories
Find more on Parametric Spectral Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
