Matlab Tutorial For Cam Design
Matlab Tutorial For Cam Design
Matlab Tutorial For Cam Design
Mechanical Design 1
MATLAB
TUTORIAL
MATLAB
MATLAB is a software package for doing numerical
computation. It was originally designed for solving
linear algebra type problems using matrices. It’s
name is derived from MATrix LABoratory.
4 4 5
[ ]
𝐴= 2
6
5
1
𝐵= 8
9 []
𝐶=[ 4 ]
A C B
𝐴𝐶=𝐵
𝐶= 𝐴 −1 𝐵
Solve Systems of Linear Equations
Solve the system using Matlab as follows:
1. Create a new m-file in edit window
2. In m-file, define distance h as symbol
Syms h
3. Write A matrix
A = [1,2,1;2,3,4;2,6,20];
3. Write B matrix
B = [h;0;0];
4. Find the solution (C matrix)
C=inv(A)*B
5. Save and run M-file
plot (x,y,x,z);
xlabel ('X values');
ylabel ('Y values');
title ('Sample Plot');
legend ('Y data’,‘Z data');
grid on;
%This is a comment
Cam Design Using Matlab
beta4=90
theta4=270:0.01:360;
s4=h-h*[10*((theta4-beta1-beta2-beta3)/beta4).^3-
15*((theta4-beta1-beta2-beta3)/beta4).^4
Cam Design Using Matlab