Question

In: Physics

(only matlab code please) solve and plot the relation between the position vs time where m1=...

(only matlab code please)

solve and plot the relation between the position vs time where m1= 1 kg , m2 = 1.5 kg (Mass) k1= 100 N/m , k2 = 125 N/m (spring) b = 1 (damper) Initial conditions: y1(0) =0.15 m , y ’1(0) =0.05 m/s y2(0) =0.05 m , y ’2(0) =0.03 m/s U1(t) = unit step starting at t (step time) = 0 sec U2 = u (t,5) (t (step time) = 5 sec) t = linspace(0,25)

and the two ordinary differential equations is as follow

(1)= d2y1/dt =(1/m1)*((u1-k1*y1)+b*(dy2/dt-dy1/dt));
(2)= d2y2/dt = (1/m2)*((u2-k2*y2)+b*(dy1/dt-dy2/dt));

where d2y1/dt represent second order of y1

Solutions

Expert Solution

% Here is the script
t=linspace(0,25,1000);
% t=linspace(0,25);
initial_Conditios=[0.15 0.05 0.05 0.03];
[t,y]=ode45(@diff_eq, t, initial_Conditios);

plot(t,[y(:,1), y(:,2)])
legend('y_1','y_2')
grid on
% code ends

Here is the function (do not copy this line)

function ODE_problem=diff_eq(t,V)
m1=100;
m2=1.5;
k1=100;
k2=125;
b=1;
U1=t>=0;
U2=t>=5;

y1=V(1);
y2=V(2);
dy1_dt=V(3);
dy2_dt=V(4);

ODE_problem=[dy1_dt;...
dy2_dt;...
(1/m1)*((U1-k1*y1)+b*(dy2_dt-dy1_dt));...
(1/m2)*((U2-k2*y2)+b*(dy1_dt-dy2_dt))];
end

Here is the screenshot


Related Solutions

solve in MATLAB and screenshot code ?′′ −??′ +??= ???(????−?????)
solve in MATLAB and screenshot code ?′′ −??′ +??= ???(????−?????)
(MATLAB ONLY) (MATLAB ONLY) (MATLAB ONLY) (MATLAB ONLY) (MATLAB ONLY) (MATLAB ONLY) Please complete the following...
(MATLAB ONLY) (MATLAB ONLY) (MATLAB ONLY) (MATLAB ONLY) (MATLAB ONLY) (MATLAB ONLY) Please complete the following Question in MATLAB ASAP, Thanks. :) 2a. Write a function that outputs the amount of freezing point depression (in degrees C) given a mass of magnesium chloride salt and a volume of water. Formula to calculate freezing point depression: ΔT = iKm in which ΔT is the change in temperature in °C, i is the van't Hoff factor, which = 3 for MgCl2 because...
you plot the position(x) vs. time(t) for an object moving at a constant acceleration. Will the...
you plot the position(x) vs. time(t) for an object moving at a constant acceleration. Will the slopes (velocity) be constant or not? why?
make a plot of the data in the table below , plot position versus time time...
make a plot of the data in the table below , plot position versus time time squared (t2 ). make sure to label your graph properly.( Y axis title with units, X axis title with unit, title of the graph with equation , major tick marks. use data to plot the graph manually. use proper scal measurement position(m) time(s) time2 (s2 ) 1 0 0 0 2 5 1 1 3 21 2 4 4 46 3 9 5 82...
Please show MATLAB code to plot below function from x = −3 to x = 12:...
Please show MATLAB code to plot below function from x = −3 to x = 12: function f = piecewise(x) % implements piecewise function using if statements if x < 0     f = -x^3 - 2*x^2 + 3*x; elseif x <= 8     f = (12/pi) * sin(pi*x/4); else     f = (600*exp(x-8))/(7*(14 + 6*exp(x-8))) -30/7; end
This code is to be written in Matlab. Write a function that will plot cos(x) for...
This code is to be written in Matlab. Write a function that will plot cos(x) for x values ranging from -pi to pi in steps of 0.1, using black *'s. It will do this three times across in one Figure Window, with varying line widths. If no arguments are passed to the function, the line widths will be 1, 2, and 3. If on the other hand, an argument is passed to the function, it is multiplier for these values....
MATLAB ONLY please. Please put the entire code below. 1. you will read a list of...
MATLAB ONLY please. Please put the entire code below. 1. you will read a list of internet logs from a notepad. 2. then you will extract the following. - a host (e.g., '146.204.224.152') - a user_name (e.g., 'feest6811' note: sometimes the username is missing! In this case, use '-' as the value for the username.) - the timme a request was made (e.g., '21/Jun/2019:15:45:24-0700') - the post request type (e.g., 'POST /incentivize HTTP/1.1' note: not everthing is a POST!) Your...
Question 5. Use MATLAB to solve for and plot the response of the following models for...
Question 5. Use MATLAB to solve for and plot the response of the following models for 0≤t ≤1.5, where the input is f (t) =5t and the initial conditions are zero a. 3¨ x +21˙ x +30x = f (t) b. 5¨ A (Turn in the MATLAB script and answers from MATLAB, .m file, screen shots if needed) B (Turn in the MATLAB plot with t being time in SI units) C Comment on the response the analytical solution compared...
In the reaction, A → Products, a plot of ln[A] vs. time is linear and the...
In the reaction, A → Products, a plot of ln[A] vs. time is linear and the slope is equal to -0.860 s-1. How long will it take one-half of the initial amount of A to react? 0.693 s 0.860 s 0.500 s 0.806 s
please Use Matlab to plot simulated results and to plot and conduct the mathematical analysis of...
please Use Matlab to plot simulated results and to plot and conduct the mathematical analysis of the data below: note: I only need these things 1- simulate the RC filter in the frequency domain in order to obtain magnitude and phase response plots. 2-obtain the transient response plots of the capacitor voltage and the current as functions of time. Channel 2 Data Time Scale: 0.002 seconds/div Voltage Scale: 2.0 volts/div Waveform Data: 500 points Time Voltage --------------------- -0.01 2.68675 -0.00996...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT