%%Matlab code for solving Finite difference method ode
clear all
close all
%creating tridiagonal matrix
dt=0.02;
a=@(tt) (2-(8*tt+1)*dt); b=@(tt) (2*(dt^2)*(-(16+tt.^2))-4);
c=@(tt) (2+(8*tt+1)*dt);
r=@(tt) (-12)*tt.^2;
%tridiagonal matrix of size n=((2-0)/dx)-1;
%all initial conditions
t_in=0; t_fnl=1;
y_in=1; y_end=0;
t=t_in:dt:t_fnl;
%number of steps
n = ((t_fnl-t_in)/dt)-1;
%Tridiagonal matrix
%A=full(gallery('tridiag',n,a,b,c));
A=zeros(n,n);
for i=2:n-1
A(i,i)=b(t(i));
A(i,i+1)=c(t(i));
A(i,i-1)=a(t(i));
end
A(1,1)=b(t(1));
A(1,2)=c(t(1));
A(n,n-1)=a(t(n));
A(n,n)=b(t(n));
for i=2:n
bb(i,1)=(2*dt^2*r(t(i)));
end
bb(1,1)=bb(1,1)-a(t(1))*y_in;
bb(n,1)=bb(n,1)-c(t(n))*y_end;
%solving using backslash operator
%all u values
y_val=A\bb;
yy(1)=y_in;
for i=2:n+1
yy(i)=y_val(i-1);
end
yy(n+2)=y_end;
%all x value
xx=t_in:dt:t_fnl;
plot(xx,yy,'Linewidth',2 )
xlabel('t')
ylabel('y(t)')
title('y(t) vs. t plot using finite difference method for
h=0.02')
fprintf('The solution vector for y=\n')
disp(yy')
%%%%%%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%%%%%%
please slove this question in MATLAB and explain clearly about it. Many thanks. Question 3. Given the following boun...
SOLVE USING MATLAB PLEASE THANKS!
The governing differential equation for the deflection of a cantilever beam subjected to a point load at its free end (Fig. 1) is given by: 2 dx2 where E is elastic modulus, Izz is beam moment of inertia, y 1s beam deflection, P is the point load, and x is the distance along the beam measured from the free end. The boundary conditions are the deflection y(L) is zero and the slope (dy/dx) at x-L...
please use matlab to solve
Problem # 3 P-3 Flow between two paralle plates is described by the following equation dith boundary conditons given as u,-0 & u,-o Calculate the velocity profile using the shooting method for solving the given BVP and compare your results by plotting the numerical solution over the plot of the analytical solution described by: (y-F )where ğr--0000025.H-О75 and h,30 Hint: use 1.75 for the first initial slope, and the other one is 0.45 to 0.5....
Differential Equation in matlab:
Please help!
Thanks
2. (30 pts.) Implement the Euler's method in MATLAB and solve the problem y a2+ y(0) 4, using different steps for the approximation. Plot the results.
Please slove using MATLAB
Problem 4 a) Determine the periods of the following two signals. b) Plot the signals between 0 program). sec and ST (T is period) using computer (attach your plot and 10 15 -15A-10
Given the following non-linear boundary value problem
Use the shooting method to approximate solution
Use finite difference to approximate solution
Plot the approximate solutions together with the exact solution
y(t) = 1/3t2 and discuss your results
with both methods
Please write clearly and answer all parts using MATLAB when
asked.
The convective heat transfer problem of cold oil (Pr > 10) flowing over a hot surface can be described by the following second-order ordinary differential equations. d^2 T/dx^2 + Pr/2 (0.332/2 x^2) dT/dx = 0 where T is the dimensionless temperature, x is the dimensionless similarity variable, and Pr is called Prandtl number, a dimensionless group that represents the fluid thermos-fluid properties. For oils, Pr = 10 - 1000,...
using matlab to solve this problem as soon as possible
thanks
use
matlab to slove the problem as soon as possible
solve the activity of number 1&2&3 by using matlab
for
this problem i need from you to solve activity one and two and
three by using matlab
DIRECTIONS: Perform the following using MATLAB. After the simulation, your report must be uploaded in the Moodle Learning system. ACTIVITY I. VECTORS AND ITS OPERATIONS Procedure 1: Define two vectors a and...
I need to solve this using Matlab please type comments in the
script so I understand thank you.
Create a table (similar to what we do in class) with all the
parameters that you have to calculate for every step in the
solution. Include y and dy/dx in the same plot with points from
your table joined by straight lines (and clearly indicate which
line correspond to what). You may use the MATLAB function you
created above.
Solve the following...
3. PARTIAL DIFFERENTIAL EQuATIONS (40 POINTS) Use the MATLAB function pdepe to solve the following boundary value problem a(t, 0) = 0, a(t, 1)=0, u(0, z) =-x2 + x. The output of your file should be the plot of the solution ( 0,1).
3. PARTIAL DIFFERENTIAL EQuATIONS (40 POINTS) Use the MATLAB function pdepe to solve the following boundary value problem a(t, 0) = 0, a(t, 1)=0, u(0, z) =-x2 + x. The output of your file should be the...
Write a MATLAB code to solve below 2nd order linear ordinary differential equation by finite difference method: y"-y'-0 in domain (-1, 1) with boundary condition y(x-1)--1 and y(x-1)-1. with boundary condition y an Use 2nd order approximation, i.e. O(dx2), and dx-0.05 to obtain numerical solution. Then plot the numerical solution as scattered markers together wi exp(2)-explx+1) as a continuous curve. Please add legend in your plot th the analytical solution y-1+
Write a MATLAB code to solve below 2nd order...