Finish the matlab homework. See attach file

1 answer below »
Finish the matlab homework. See attach file
Answered Same DayNov 06, 2021

Answer To: Finish the matlab homework. See attach file

Kshitij answered on Nov 07 2021
144 Votes
First.m
%%%THe Symbolic math is used in matlab for representation of mathmatical equations
clear all; close all; clc %% Clear all previous variables and screen
syms x y %% Declaring x and y as symbols
y = x^2; %% Setting y =x^2.
y = subs(y,x,2); %% Using subs command, the value of y will be substituted with x^2
y = subs(y,x,3); %% Using subs command, the value of y will be substituted with x^3
Fourth.m
clear all; close all; clc
% Define Symbolic Variables
syms x a t s
f1 = exp (-a*t);
f2 = dirac(t-a);
f3 = heaviside(t-a);
% Laplace Transform
F1 = laplace(f1);
F2 = laplace(f2);
F3 = laplace(f3);
% Inverse Laplace Transform
f1_inv = ilaplace(F1);
f2_inv = ilaplace(F2);
f3_inv = ilaplace(F3);
% Substitution (Time Domain Plotting)
t = 0
:0.01:10;
a = 1;
f_time = subs(f1_inv);
figure (1)
plot(t,f_time)
Project Report.docx
Mass Spring Damper System
Course: MME 315: Mechanical Vibrations
Submission Date:
Student Name:
Student Number:
Signature:
Numerical Solutions (Sec 3.8)
The task in hand is to compute the analytical, numerical, laplace and Simulink modeling of spring mass damper system shown in following figure
Following the above model, following equation represent this model
Where the parameters for the given circuit is defined as,
1. Analytical Method
From the graph give, the system can be divided into two conditions, one is when is less then or equal to and second is when t is greater than
· For
Doing integration by parts
Replacing
As
·
2. Numerical Method
Solving it further results in
Writing it in state space model
Where
So
This can be written in simpler form as
3. Laplace Transform
Using initial given conditions,
Taking Laplace Transform of above equation
This could be written in symbolic form in Matlab/Simulink
4. Simulink Modeling
The block diagram of above-mentioned equation is as follows
Appendix (Coding)
%%%THe Symbolic math is used in matlab for representation of mathmatical equations

clear all; close all; clc %% Clear all previous variables and screen
syms x y %% Declaring x and y as symbols
y = x^2; %% Setting y =x^2.
y = subs(y,x,2); %% Using subs command, the value of y will be substituted with x^2
y = subs(y,x,3); %% Using subs command, the value of y will be substituted with x^3
clear all; close all; clc %% Clear all previous variables and screen
syms x c t s %% Declaring x c, k and s as symbols
f1 = exp (-c*t); %% Taking Exponential
f2 = dirac(t-c); %% Taking Dirac Delta Function
f3 = heaviside(t-c); %% Taking Heavy side step function
%%
F1 = laplace(f1); %%Taking Laplace transform of f1
F2 = laplace(f2); %%Taking Laplace transform of f2
F3 = laplace(f3); %%Taking Laplace transform of f3
%%
f1_inv = ilaplace(F1); %%Taking Inverse Laplace transform of f1
f2_inv = ilaplace(F2); %%Taking Inverse Laplace transform of f2
f3_inv = ilaplace(F3); %%Taking Inverse Laplace transform of f3
%%
t = 0:0.05:16; %Defing duration for plotting
c = 2; % Definging constant c
f_time = subs(f1_inv); %% Sunstituting time domain with inverse laplace
figure
plot(t,f_time)

%%
f_time = subs(f2_inv); %% Sunstituting time domain with inverse laplace
figure
plot(t,f_time)
%%
f_time = subs(f3_inv); %% Sunstituting time domain with inverse laplace
figure
plot(t,f_time)
clear all;close all; clc
% Define Symbolic Variables
syms n t m
% n=4;
% m=2;
F = symsum((2*(1-cos(n*pi))/(n*pi))*sin(n*t),n,1,m);
fplot(subs(F));
% Symbolic Math - Convolution Integral
% 10xdd+20xd+1500x=20cos25t+10cos15t+20cos2t,[x0=0; v0=0]
clear all;close all; clc
m = 10;c = 20;k = 1500;wn = sqrt(k/m);zeta = c/(2*wn*m);
wd = wn*sqrt(1-zeta^2);f0 = [20 10 20]/m;w = [25 15 2];
syms t tau
% Unit impulse response function (underdamped system)
h = (1/(m*wd))*exp(-zeta*wn*(t-tau)).*sin(wd*(t-tau));
% Forcing function
F =m*(f0(1)*cos(w(1)*tau)+f0(2)*cos(w(2)*tau)+f0(3)*cos(w(3)*tau));
% Convolution Integral
CI = F.*h;
% Symbolic Integration of the Convolution Integral
CI_int = int (CI,tau,0,t);
% Defining the time vector
t = 0:0.01:10;
% Substituting the t vector to the symbolic convolution
integral to obtain x(t)
x = subs(CI_int,t);
% Plot
figure(1)
plot(t,x);xlabel('Time (sec)');ylabel('Displacement (m)');
MME 315: Mechanical Vibrations         9
Project Report.pdf
MME 315: Mechanical Vibrations 1
Mass Spring Damper System
Course: MME 315: Mechanical Vibrations
Submission Date:
Student Name:
Student Number:
Signature:
MME 315: Mechanical Vibrations 2
Numerical Solutions (Sec 3.8)
The task in hand is to compute the analytical, numerical, laplace and Simulink modeling
of spring mass damper system shown in following figure
Following the above model, following equation represent this model
?�̈�(?) + ?�̇�(?) + ??(?) = ?(?)
Where the parameters for the given circuit is defined as,
?? = 30?
? =
1000?
?

? = 0.1
?? = 3.16
?? = 2 ???
?(0) = 0 ?
?(0) = 0
?
?
MME 315: Mechanical Vibrations 3
1. Analytical Method
From the graph give, the system can be divided into two conditions, one is when ? is less
then or equal to ?? and second is when t is greater than ??
 For 0 < ? < ??
?(?) = ∫ ?(?)ℎ(? − ?)?? + ∫ ?(?)ℎ(? − ?)??
?
??
??
0

?(?) = ∫ (??)ℎ(? − ?)?? + ∫ (0)ℎ(? − ?)??
?
??
??
0

?(?) = ∫ (
??
???
) ?−???(?−?) sin ??(? − ?) ??
??
0

?(?) =
??
???
?−???? ∫ (?−????) sin ??(? − ?) ??
??
0

Doing integration by parts
?(?) =
??
?
[1 −
?−???(?−??)
√1 − ?2
cos(??(? − ??) − ?)]
Replacing ? = ???−1
?
√1−?2

As ? → ∞
?(?) =
??
?

 ? > ??
?(?) = ∫ ?(?)ℎ(? − ?)??

??

?(?) = 0
MME 315: Mechanical Vibrations 4
2. Numerical Method
?�̈�(?) + ?�̇�(?) + ??(?) = ?(?)
?(?) = ??Φ(? − ??)
Solving it further results in
�̈�(?) + 2???�̇�(?) + ??
2?(?) =
??
?
Φ(? − ??)
Writing it in state space model
?1 = ?
?2 = �̇�
Where
?1̇ = �̇� = ?2
?2̇ = �̈� = −
?
?
? −̇
?
?
? +
??
?
Φ(? − ??)
So
[
?1̇
?2̇
] = [
0 1

?
?

?
?
] [
?1
?2
] + [
0
??
?
Φ(? − ??)
]
[
?1̇
?2̇
] = [
0 1
??
2 2???
] [
?1
?2
] + [
0
??Φ(? − ??)
]
This can be written in simpler form as
? = ?? + ?̇
MME 315: Mechanical Vibrations 5
3. Laplace Transform
?�̈�(?) + ?�̇�(?) + ??(?) = ?(?)
Using initial given conditions,
?? = 0
?? = 0
Taking Laplace Transform of above equation
??2?(?) + ???(?) + ??(?) = ℒ(?(?))
?(?) =
ℒ(?(?))
??2 + ?? + ?

This could be written in symbolic form in Matlab/Simulink
4. Simulink Modeling
?�̈�(?) + ?�̇�(?) + ??(?) = ?(?)
The block diagram of above-mentioned equation is as follows
1
?

1
?
�̈� �̇� ?
?? ??
MME 315: Mechanical Vibrations 6
Appendix (Coding)
%%%THe Symbolic math is used in matlab for representation of mathmatical
equations

clear all; close all; clc %% Clear all previous variables and screen
syms x y %% Declaring x and y as symbols
y = x^2; %% Setting y =x^2.
y = subs(y,x,2); %% Using subs command, the value of y will be substituted
with x^2
y = subs(y,x,3); %% Using subs command, the value of y will be substituted
with x^3
clear all; close all; clc %% Clear all previous variables and screen
syms x c t s %% Declaring x c, k and s as symbols
f1 = exp (-c*t); %% Taking Exponential
f2 = dirac(t-c); %% Taking Dirac Delta Function
f3 = heaviside(t-c); %% Taking Heavy side step function
%%
F1 = laplace(f1); %%Taking Laplace transform of f1
F2 = laplace(f2); %%Taking Laplace transform of f2
F3 = laplace(f3); %%Taking Laplace transform of f3
%%
f1_inv = ilaplace(F1); %%Taking Inverse Laplace transform of f1
f2_inv = ilaplace(F2); %%Taking Inverse Laplace...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here