Question

Problem 4 (Stiff ODE) We consider a chemical reaction system due to H. Robertson that has been extensively tested as a test p

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


title(t vs. yl(t) plot for ode45) xlabel(t) ylabel(y(t)) subplot(3,1,2) plot (t1, soli(:,2)) title(t vs. y2(t) plot fo title(t vs. yl(t) plot for ode45) xlabel(t) ylabel(y(t)) subplot(3,1,2) plot (t1, soli(:,2)) title(t vs. y2(t) plot fotvs. y(t) plot for ode45 0.98 0.96 0.94 0 0. 5 1 1.5 tvs. y2(t) plot for ode45 211 y2(t) 0.5 15 2.5 tvs. y2(t) plot for ode45

%%Matlab code for solving ode
clear all
close all
%Answering question
%Initial conditions for ode
    u0=[1;0;0];
    alpha=0.04; beta=1*10^4; gamma=3*10^7;
%Solution for equation 1. using ode45
        %minimum and maximum time span
        tspan=[0 3];
        %Solution of ODEs using ode45 matlab function
        [t1,sol1]= ode45(@(t,y) odefcn(t,y,alpha,beta,gamma), tspan, u0);

        %Plotting the solution
        figure(1)
        subplot(3,1,1)
        plot(t1,sol1(:,1))
        title('t vs. y1(t) plot for ode45')
        xlabel('t')
        ylabel('y(t)')
      
        subplot(3,1,2)
        plot(t1,sol1(:,2))
        title('t vs. y2(t) plot for ode45')
        xlabel('t')
        ylabel('y2(t)')
     
        subplot(3,1,3)
        plot(t1,sol1(:,3))
        title('t vs. y2(t) plot for ode45')
        xlabel('t')
        ylabel('y3(t)')
      
        fprintf('At t=3, y1(3)=%f, y2(3)=%f and y3(3)=%f\n',...
            sol1(end,1),sol1(end,2),sol1(end,3))
        fprintf('Using ode45 it required %d time steps to achive it.\n',length(t1))
%Initial conditions for ode
    u0=[1;0;0];
    alpha=0.04; beta=1*10^4; gamma=3*10^7;
%Solution for equation 1. using ode45
        %minimum and maximum time span
        tspan=[0 10^6];
        %Solution of ODEs using ode45 matlab function
        [t1,sol1]= ode15s(@(t,y) odefcn(t,y,alpha,beta,gamma), tspan, u0);

        %Plotting the solution
        figure(2)
        subplot(3,1,1)
        plot(t1,sol1(:,1))
        title('t vs. y1(t) plot for ode45')
        xlabel('t')
        ylabel('y(t)')
      
        subplot(3,1,2)
        plot(t1,sol1(:,2))
        title('t vs. y2(t) plot for ode45')
        xlabel('t')
        ylabel('y2(t)')
     
        subplot(3,1,3)
        plot(t1,sol1(:,3))
        title('t vs. y2(t) plot for ode45')
        xlabel('t')
        ylabel('y3(t)')
      
        fprintf('At t=1.E+6, y1(1.E+6)=%f, y2(1.E+6)=%f and y3(1.E+6)=%f\n',...
            sol1(end,1),sol1(end,2),sol1(end,3))
        fprintf('Using ode15s it required %d time steps to achive it.\n',length(t1))      
      
      

%Function for evaluating the ODE
function du1dt = odefcn(t,y,alpha,beta,gamma)

    eq1 = -alpha*y(1)+beta*y(2)*y(3);
    eq2 = alpha*y(1)-beta*y(2)*y(3)-gamma*(y(2)).^2;
    eq3 = gamma*(y(2)).^2;
  
  
    %Evaluate the ODE for our present problem
    du1dt = [eq1;eq2;eq3];
end

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

Add a comment
Know the answer?
Add Answer to:
Problem 4 (Stiff ODE) We consider a chemical reaction system due to H. Robertson that has...
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
  • Problem 3. Linearization of a nonlinear system at a non-hyperbolic fixed point] Consider the nonlinear system...

    Problem 3. Linearization of a nonlinear system at a non-hyperbolic fixed point] Consider the nonlinear system t' =-y+px(x² + y) (4) y = 1+ y(x² + y2), where is a parameter. Obviously, the origin x* = (0,0) is a fixed point of (4). (e) The solution of the ODE for o(t) is obvious - the angle o increases at a constant rate. Without solving the ODE for r(t), explain how r(t) behaves when t o in the cases H<0,1 =...

  • Problem1: Consider the translational system shown in the figure below. Att-0,x (displacement)-y (...

    Problem1: Consider the translational system shown in the figure below. Att-0,x (displacement)-y (let y represents velocity)-fat)0. The physical constants are: M-3,B1,B2B 0.5. Find the first order system equation in y and do following. a) Find the response, y(t) of the system when subjected to a step input,falt)-A b). Find time constant, "7". c Identify the steady state, "yss" and transient, "yr" part of the response. d). Sketch the complete response when the input is unit step function. e). Is the...

  • 1. Consider the problem of steady state heat flow in the half-plane, 22T a2T + ar2...

    1. Consider the problem of steady state heat flow in the half-plane, 22T a2T + ar2 =0 for ER and y>0, ay2 subject to the boundary condition T(3,0) = g(x), and T +0 as yo. You will solve the problem using the Fourier transform in 2, with T(w,y) = ZELT(, y)e-iw= ds 2 (a) Derive an ODE for T. You can assume T +0 as|a . (b) Derive conditions for I at y = 0 and as y. You can...

  • Problem 1 Open-loop tersus Closed-loop control: Consider a first-order system Σ' with inputs (d,u) and output...

    Problem 1 Open-loop tersus Closed-loop control: Consider a first-order system Σ' with inputs (d,u) and output y, governed by Z(t) y(t) ar(t1+hd(t)+5a1(t), cr(t) = = (a) Assume Σ is table (ie, a < 0). For Σ, what is the steady-state gain fron u to y (assuming d 0)? What is the steady-state gain from d to y (assuming t. 0)? These are the open-loop steady-state gains. Call these SSGy and SSGgby respectively (b) Σ is controlled by a "proportional" controller...

  • Problem 3 A unity feedback system has the loop transfer function G(s) = Kata) s(s +...

    Problem 3 A unity feedback system has the loop transfer function G(s) = Kata) s(s + (a) Find the breakway and entry points on the real axis. (b) Find the gain and the roots when the real part of the complex roots is located at -2 (c) Sketch the root locus. Problem 4 The forward path G(s) of a unity feedback system with input R(s) and output Y (s) is given by G(o) 106I) (a) What is the type of...

  • For this problem we consider a radiant heat transfer system commonly found in space/room heaters. The input to the plan...

    For this problem we consider a radiant heat transfer system commonly found in space/room heaters. The input to the plant is (heat) energy q(Watts) and the output of the system is its temperature (K). The ODE that describes the system is given below Where, 8a is the ambient temperature (27°C), b-91.6 is an input constant, m 0.1 kg is the mass, C 420 J/Kg.K is the specific heat of the heater and a-AEo. A0.25 m2 is the surface area of...

  • 4. Consider the following closed-loop system in which G(s) = and H(s) = 1. de)_ GC)...

    4. Consider the following closed-loop system in which G(s) = and H(s) = 1. de)_ GC) ylt) Derive the transfer function刽 2, where E (s) = R(s) H(s)Y(s). What is the smallest value of K for which the steady-state error due to a unit step disturbance, d(t) -), s less than 0.05? Ea(s) D(s)

  • Problem 4: Evaluation of the convolution integral too y(t) = (f * h)(t) = f(t)h(t –...

    Problem 4: Evaluation of the convolution integral too y(t) = (f * h)(t) = f(t)h(t – 7)dt is greatly simplified when either the input f(t) or impulse response h(t) is the sum of weighted impulse functions. This fact will be used later in the semester when we study the operation of communication systems using Fourier analysis methods. a) Use the convolution integral to prove that f(t) *8(t – T) = f(t – T) and 8(t – T) *h(t) = h(t...

  • 3. Consider a system with the following state equation h(t)] [0 0 21 [X1(t) [x1(t) y(t)...

    3. Consider a system with the following state equation h(t)] [0 0 21 [X1(t) [x1(t) y(t) [0.1 0 0.1x2(t) X3(t) The unit step response is required to have a settling time of less than 2 seconds and a percent overshoot of less than 5%. In addition a zero steady-state error is needed. The goal is to design the state feedback control law in the form of u(t) Kx(t) + Gr(t) (a) Find the desired regon of the S-plane for two...

  • plz solve this problem [10] Consider the system shown below. Design the PD controller such that the closed loop syst...

    plz solve this problem [10] Consider the system shown below. Design the PD controller such that the closed loop system satisfies the following specifications. a) The steady-state error with respect to a step disturbance W (s) is no more than 10 %. b) The third order system gives a dominant 2nd order response such that the third pole s=p satisfies p 10wn, where Zwn is the damping constant. |W(s) Y(s) 1 E(S)Kp+Kps R(s) s(s+10) [10] Consider the system shown below....

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