Numirecal integration for a vector

6 次查看(过去 30 天)
Hi everybody,
I am designing non-circular gears using MATLAB. I have designed several types. My last step is to generate the general case which starts from the speed ratio variation. I have this equation (in the photo attached).
I have the speed ratio as a vector and also I have the input angle. I need to calculate the second gear output angle. I think that I need to integrate the vector to get my goal, but how??????????
I need help in this. please.
% this program is for calculating the NCG (non-circular gear) with no approximation
clear, clc
disp('This program generates NCG depending on the imported speed ratio form Excel file')
disp('and entered center distance')
Ratio=xlsread('speed_ratio.xlsx','A:A');
Ratio=Ratio';
Center_dis=input('Enter the center distance value in mm, Center_distance= '); % use 89.305
m=input('enter the module you want to use in mm, m= '); % use 3
phi=input('enter the standard pressure angle in degrees, phi= '); % use 20
disp('*')
disp('*')
disp('The solution depends on the main equation of NCG design and geanaration')
disp('*')
disp('*')
% the input angle is equal parts since the driving gear angular velocity is
% constant, so depending on the number of the speed ratio elements, we
% can divide the one rotation (2*pi) to the same number of elements
Input_ang=0:0.0001*pi:2*pi;
% plot the speed ratio variations
figure(1)
% plot the center
plot(0,0,'or','LineWidth',5)
hold on
plot(Input_ang,Ratio,'LineWidth',3)
title('The speed ratio variations of the NC-gearset')
xlabel('input angle')
ylabel('W_2/ W_1')
axis equal
grid on
% generating the first centrode with its evolute, base curve, tip and root curve.
R_c1=(Center_dis.*Ratio)./(1+Ratio);
X_c1=R_c1.*cos(Input_ang);
Y_c1=R_c1.*sin(Input_ang);
% plot it with clear zero point
figure(2)
% plot the center
plot(0,0,'or','LineWidth',5)
hold on
plot(X_c1,Y_c1,'k')
title('The first centrode')
xlabel('X')
ylabel('Y')
axis equal
grid on
% generating the second centrode with its evolute, base curve, tip and root curve.
R_c2=Center_dis-R_c1;
% here I need to calcualte the second gear rotating angle but how???????? need help.
  2 个评论
darova
darova 2019-9-1
Use diff() or gradient() to differentiate a vector
nezir elali
nezir elali 2019-9-3
Dear Darova,
I used diff and gradient function previously,
I am looking for integrating a vector with the same way like diff.
anyway thanks for answering

请先登录,再进行评论。

回答(1 个)

Steven Lord
Steven Lord 2019-9-3
See the trapz or cumtrapz functions.
  1 个评论
nezir elali
nezir elali 2019-9-7
Thanks for answering Steven,
I tried to use cumtrapz but I don't know if I used it ok or not.
I tried to do something else.
I tried to make integration for the vector like accumlative but stil I have a problem since the Output_ang is more than 2*pi I mean th last element in the output_ang must be 2*pi not more at all.
any ideas??????????!!!!!!!!!!!!!!
% this program is for calculating the NCG (non-circular gear) with no approximation
clear, clc
disp('This program generates NCG depending on the imported speed ratio form Excel file')
disp('and entered center distance')
Ratio=xlsread('speed_ratio.xlsx','A:A');
Ratio=Ratio';
Center_dis=input('Enter the center distance value in mm, Center_distance= '); % use 89.305
m=input('enter the module you want to use in mm, m= '); % use 3
phi=input('enter the standard pressure angle in degrees, phi= '); % use 20
disp('*')
disp('*')
disp('The solution depends on the main equation of NCG design and geanaration')
disp('*')
disp('*')
% the input angle is equal parts since the driving gear angular velocity is
% constant, so depending on the number of the speed ration elements, we
% can divide the one rotation (2*pi) to the same number of elements
Input_ang=0:0.0001*pi:2*pi;
% plot the speed ratio variations
figure(1)
% plot the center
plot(0,0,'or','LineWidth',5)
hold on
plot(Input_ang,Ratio,'LineWidth',3)
title('The speed ratio variations of the NC-gearset')
xlabel('input angle')
ylabel('W_2/ W_1')
axis equal
grid on
% generating the first centrode with its evolute, base curve, tip and root curve.
R_c1=(Center_dis)./(1+Ratio);
X_c1=R_c1.*cos(Input_ang);
Y_c1=R_c1.*sin(Input_ang);
% plot it with clear zero point
figure(2)
% plot the center
plot(0,0,'or','LineWidth',5)
hold on
plot(X_c1,Y_c1,'k')
title('The first centrode')
xlabel('X')
ylabel('Y')
axis equal
grid on
% generating the second centrode with its evolute, base curve, tip and root curve.
% R_c2=Center_dis-R_c1; % first choice
R_c2=(Center_dis.*Ratio)./(1+Ratio); % second choice
% finding the rotating angle of the second gear
Output_ang=zeros(1,length(Ratio));
for i=2:length(Ratio) % first choice to integrate the vector methodolgy to integrate like cumtrapz
Output_ang(i)=0.0001*pi.*(1./Ratio(i))+Output_ang(i-1);
end
% this method from the net as second choice to integrate the vector
% func=0.0001*pi./Ratio;
% output_angle=cumtrapz(func); it is not correct
Output_ang=pi-Output_ang;
X_c2=R_c2.*cos(Output_ang);
Y_c2=R_c2.*sin(Output_ang);
% plot it with clear zero point
figure(3)
% plot the center
plot(0,0,'or','LineWidth',5)
hold on
plot(X_c2,Y_c2,'k')
title('The second centrode')
xlabel('X')
ylabel('Y')
axis equal
grid on

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by