Question

In: Advanced Math

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 with the MATLAB and the plots. (Do the calculations and MATLAB agree ? Why and Why not.? Do the plots make sense?)

Solutions

Expert Solution


%Matlab code for solving differential equation
clear all
close all
syms x(t)
eqn = 3.*diff(x,t,2)+21.*diff(x,t,1)+30.*x(t)== 5.*t;
Dx = diff(x,t);
cond = [x(0)==0, Dx(0)==0];
ySol(t) = dsolve(eqn,cond);

fprintf('Displaying the analytical solution y(t)=\n')
disp(ySol(t))

%Initial conditions for ode
    x0=[0;0];
%Solution for equation using ode45
        %minimum and maximum time span
        tspan=[0 1.5];
        %Solution of ODEs using ode45 matlab function
        sol= ode45(@(t,x) odefcn1(t,x), tspan, x0);
        %Equally splitting time into .02 sec interval for 0 to 50
        t1 = linspace(tspan(1),tspan(end),1001);
        %yy is the corresponding x y v and z
        yy1 = deval(sol,t1);
      
%Plotting of x(t) y(t) and z(t)
figure(1)
hold on
plot(t1,ySol(t1))
plot(t1,yy1(1,:))
legend('Exact solution','Numerical solution')
title('Plot for x vs. t')
xlabel('time')
ylabel('X(t)')
box on; grid on;

%Function for evaluating the ODE
function dxdt = odefcn1(t,x)

    eq1=x(2);
    eq2=(5*t-21.*x(2)-30.*x(1))./3;

    %Evaluate the ODE for our present problem
    dxdt = [eq1;eq2];
end

    %%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%


Related Solutions

Use MATLAB DSOLVE to solve the folloing ODE and plot it: 300x'' + 60x' + 6840...
Use MATLAB DSOLVE to solve the folloing ODE and plot it: 300x'' + 60x' + 6840 = f(t)
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...
define a matlab question and solve with matlab codes (rlc circuts)
define a matlab question and solve with matlab codes (rlc circuts)
Find frequency response of the system given by following equation using MATLAB. Clearly plot both amplitude...
Find frequency response of the system given by following equation using MATLAB. Clearly plot both amplitude and phase response waveforms with labels assigned. y[n+1]-0.5 y[n]=x[n] Matlab code would be greatly appreciated
Use Matlab to do the following (please) : 1. Plot the following signals in one figure...
Use Matlab to do the following (please) : 1. Plot the following signals in one figure window using Matlab commands. Given x (n) = {5,2,1,3,1,4,2} plot x(3n) 2. Plot all transformations of a Gaussian signal in one figure window 3. Plot r(-3t-9).
3. Use matlab to plot the output voltage of an inverting operational amplifier given the following...
3. Use matlab to plot the output voltage of an inverting operational amplifier given the following conditions: K = Gain of the amplifier = 12.5. Vi = input voltage -2.5 < Vi < 2.5 V], (use 0.25 increments). V+ = positive power supply voltage, V+ = +20 V. V- = negative power supply voltage V- = -20V. Vo = output voltage Vo = -KVi Recall that if the output voltage Vo is greater than V+, or less than V-, the...
Plot the original data and the regression “line” ************USING Matlab************. "Submit plot" USING MATLAB! USING MATLAB!...
Plot the original data and the regression “line” ************USING Matlab************. "Submit plot" USING MATLAB! USING MATLAB! USING MATLAB! ONLY BY USING MATLAB!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 14.9 The concentration of E. coli bacteria in a swimming area is monitored after a storm: t (hr)                     4           8         12        16    20 24 c (CFU/100 mL) 1600     1320   1000     890 650 560 The time is measured in hours following the end of the storm and the unit CFU is a .colony forming unit.. Use this data to estimate (a)...
Use matlab to solve the following: A field-controlled DC motor can be described by the following...
Use matlab to solve the following: A field-controlled DC motor can be described by the following differential equation: ay3(t)+by2(t)+cy1(t) = dx(t) Where y(t) is the angle displacement of the motor’s load and x(t) is the applied voltage to the motor. The applied voltage is DC that turns on at t = 0, which is a step function. The values for a,b,c and d are derived from the model of the field controlled DC motor. This is a concept that is...
use a matlab built-in function to numerically solve: dy/dx= -x^2+((x^3*e^-y)/4) for 1<=x<=5 with y(1)=1 plot the...
use a matlab built-in function to numerically solve: dy/dx= -x^2+((x^3*e^-y)/4) for 1<=x<=5 with y(1)=1 plot the solution
(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)...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT