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)
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
solve any question about fourier series by using MATLAB
solve any question about fourier series by using MATLAB
This is a Matlab Question Create MATLAB PROGRAM that can solve First Order Linear Differential Equation...
This is a Matlab Question Create MATLAB PROGRAM that can solve First Order Linear Differential Equation ( 1 example contains condition and the other does not have condition). 1. ty′ + 2y = t^2 − t + 1, y(1)=12 The correct answer is y(t) = 1/4 t^2 − 1/3 t + 1/2 + 1/12t^2 2. (x-1) dy/dx + 2y = (x+1)^2 The correct answer is y = (x(x+1) / x-1 ) + C(x+1) / x-1 The correct answer is
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT