0% found this document useful (0 votes)
32 views2 pages

x (t) =sin (2 πt) + k

This document contains two MATLAB questions and solutions. The first question generates a function that is the sum of three sine waves with different frequencies. The solution uses a for loop to calculate the sum of the sine waves at instances from 0 to 1 in increments of 0.01. The second question involves a 10 kg slider on an inclined plane attached to a spring. The solution plots the velocity of the slider as it passes point C versus the initial spring stretch between -0.4 and 0.8 m. The velocity approaches infinity when the spring stretch exceeds 0.65 m, as the force balance equation no longer has a real solution.

Uploaded by

Piya Chowdhury
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views2 pages

x (t) =sin (2 πt) + k

This document contains two MATLAB questions and solutions. The first question generates a function that is the sum of three sine waves with different frequencies. The solution uses a for loop to calculate the sum of the sine waves at instances from 0 to 1 in increments of 0.01. The second question involves a 10 kg slider on an inclined plane attached to a spring. The solution plots the velocity of the slider as it passes point C versus the initial spring stretch between -0.4 and 0.8 m. The velocity approaches infinity when the spring stretch exceeds 0.65 m, as the force balance equation no longer has a real solution.

Uploaded by

Piya Chowdhury
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

MATLAB

Question 1
Use Matlab to generate the function:
3
1 1 1
x ( t )=sin ( 2 πt ) + sin ( 6 πt ) + sin ( 10 πt )=∑ sin ( 2 πkt ) , for 0 ≤ t ≤1
3 5 k=1 k

At instances t=0 :0.01 : 1

Solution

t = 0:0.01:1; N = length(t); xt = zeros(1,N);


for n = 1:N
temp = 0;
for k = 1:3
temp = temp + (1/k)*sin(2*pi*k*t(n));
end
xt(n) = temp;
end
Mechanical MATLAB
The 10-kg slider A moves with negligible friction up the inclined guide. The attached spring
has a stiffness of 60 N/m and is stretched δ m at position A, where the slider is released from
rest. The 250-N force is constant and the pulley offers negligible resistance to the motion of
the cord. Plot the velocity of the slider as it passes C as a function of the initial spring stretch
δ. Let δ vary between -0.4 and 0.8 m and explain the results when δ exceeds a value of about
0.65 m.

MATLAB Solution

%%%%%%%%%%%%%%%% Script %%%%%%%%%%%%%%%%% % This script


plots the velocity of the slider % at C versus the initial
spring stretch del del = -0.4:0.01:0.8; v = 1/10*sqrt(958-
1440*del); plot(del,v) axis([-0.4 0.8 0 4]) xlabel('initial
spring stretch (m)') ylabel('velocity (m/s)') %%%%%%%%%%%%%
end of script %%%%%%%%%%%%%%%

You might also like