Question

Problem Set A Problem 6. (20%) A ordinary differential equation for a mass-damper-spring system is following. The mass m 1, d6. Problem ordinary differential equation for a mass-damper-spring system is following. The mass m 1, damping coefficient c,

0 0
Add a comment Improve this question Transcribed image text
Answer #1

MATLAB code is given below in bold letters.

main MATLAB script file code:

clc;
close all;
clear all;

% define the Ode solver as given below
[t,y] = ode23(@vdp1,[0 20],[0 ; 0]);
% Plot the solutions for and against t.

figure;plot(t,y(:,1),'-o',t,y(:,2),'-o')
title('Solution with ODE23');grid;
xlabel('Time t');
ylabel('Solution');
legend('position','velocity');

functionn file code:

function dydt = vdp1(t,y,mu)

% define the parameters as follows
m = 1;
c = 1;
k = 3;
f = 10;

% define the first order state space differential equations as given below
dydt = [y(2); 1/m*(-k*y(1)-c*y(2) + f)];

Result:

Add a comment
Know the answer?
Add Answer to:
Problem Set A Problem 6. (20%) A ordinary differential equation for a mass-damper-spring system is following....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT