- Type
- Quiz
- Course
- MTH643 Introduction to MATLAB
- Size
- PDF 732 KB
- Updated
- 23 Oct 2026
You get 3 free files a day on the website. Add the Chrome extensionSign in with the extension for 30 a day.
Preview text
Text from pages 1, 2, 3 of 32. Download the file for all 32 pages.
L09&15_Q01: Find the numerical plot of the following initial value problem on [0,2]:
%Find the numerical plot of the following initial value problem on [0,2]: % y^'(x)=y-x^2+1 ,y(0)=0.5 clc clear all close all
ode45(f,[0,2],0.5)
title(' Numerical Plot of IVP') grid L09&15_Q02: Plot the family of the approximate solutions of the following Initial Value Problem
%Plot the family of the approximate solutions of the following Initial Value Problem (IVPs): % y^'(x)=y-x^2+1 ,y(0)=0.5:0.3:3 clc clear all close all
ode45(f,[0,2],0.5:0.3:3)
title(' Family of the approximate solutions of IVPs') grid L09&15_Q03: Compute the numerical values of the approximate solution of the following IVP at x=
%Compute the numerical values of the approximate solution of the following IVP % at x= 0:0.2:2, y^'(x)=y-x^2+1 ,y(0)=0.5 clc clear all close all
[x,ya]=ode45(f,0:0.2:2,0.5) plot(x,ya) L09&15_Q04: Find the exact solution of the following IVPs, then compute its approximate solution at x=0:0.2:2 using ode45 command. Finally, makes the table of values at t,ya and y(exact solution).
%Find the exact solution of the following IVPs, %then compute its approximate solution at x=0:0.2:2 using ode45 command. %Finally, makes the table of values at t,ya and y(exact solution). %y'(x)=y-x^2+1 ,y(0)=0.5 clc clear all close all eq=' Dy=y-x^2+1'; initialcond='y(0)=0.5'; y=dsolve(eq,initialcond,'x')
[x,ya]=ode45(f,0:0.2:2,0.5) [x,ya,2.*x-exp(x)./2+x.^2+1] L09_Q05: Find the exact solution of the following IVPs at some specific domain elements, x=-0.2,-0.4, -0.6, -0.8, -1.0 in the interval [-1,0] using ode45 command.
% Find the exact solution of the following IVPs at some specific domain elements, % x=-0.2,-0.4, -0.6, -0.8, -1.0 in the interval [-1,0] using ode45 command. % y'(x)=y-x^2+1, y(0)=0.5 clc clear all close all
ode45(f,0:-0.2:-1,0.5)
title(' Graphical view of IVP when initial condition is mentioned at the right end pont') grid L09_Q06: Plot the family of the approximate solutions of the following IVP on the interval [-1, 2] using
%Plot the family of the approximate solutions of the following IVP on the interval [-1, 2] % using ode45 command. y'(x)=y-x^2+1 ,y(0)=1:0.2:3 clc clear all close all
[x,y]=ode45(f,[0,-2],1:0.2:3); plot(x,y) hold on [x1,y1]=ode45(f,[0,2],1:0.2:3); plot(x1,y1) hold off
title(' Family of approximation solutions of IVPs') grid L09_Q07: Find the numerical solution of system of non linear initial value problems.
%Find the numerical solution of system of Non linear initial value problems. %dx/dt=-x+3z,dy/dt=-y+2z,dz/dt=x^2-2z %x(0)=1,y(0)=1/2,z(0)=3,tspan=[0,3] by using ode45 command clc clear all close all
tspan=[0,1.5]; x0=1; y0=0.5; z0=3;
[t,x]=ode45(f,tspan,[x0 y0 z0]) plot3(x(:,1),x(:,2),x(:,3))
grid
L09_Q08: Find the numerical solution of system of initial value problems.
0,5 by using ode45 command. %Find the numerical solution of system of initial value problems. %dy/dt=2t clc clear all close all
tspan=[0,5]; y0=0; [t,y]=ode45(f,tspan,y0) plot(t,y)
grid
L09_Q09: Compare the exact and approximate solution of
using ode45 command. %Compare the exact and approximate solution of dy/dt=t+y ,
clc clear all close all
tspan=[0,5]; y0=3; [t,y]=ode45(f,tspan,y0); exactsoln=dsolve(' Dy=t+y','y(0)=3','t'); exact=eval(vectorize(exactsoln)); table=[t,y,exact] plot(t,y,'b',t,exact,'r') legend(' Approximate',' Exact')
title(' Comparing exact and approximate solution of ODE') L10_Q10: Create ROW VECTOR by following four ways. Elements separated by commas, elements separated by spaces, by using colon when elements of row vector iterate with equal interval, by using colon sign and increment value by between starting and ending element. %Create ROW VECTOR by following four ways. % 1. Elements separated by commas. % 2. Elements separated by spaces. % 3. By using colon when elements of row vector iterate with equal interval. % 4. By using colon sign & increment value by b/w starting & ending element. clc clear all close all echo on RV1=[2,3,4,5,6] RV2=[2 3 4 5 6] RV3=2:6 RV4=2:1:6 echo off
L10_Q11: Create COLUMN VECTOR by following ways. Elements separated by semi colon, elements separated by spaces or commas and then taking transpose. % Create COLUMN VECTOR by following ways. % 1. Elements separated by semi colon % 2. Elements separated by spaces or commas and then taking transpose. clc clear all close all echo on
Related MTH643 files
All MTH643 files →Get more out of VUBuddy, for free
- Unlimited downloads
- The explanation behind every MCQ answer
- Study offline on slow data
- 30 downloads a day instead of 3
- Sign in and buy Pro Semester here
One Pro Semester membership works in both the extension and the app.