Professional Documents
Culture Documents
4 (A) Given Below A MATLAB Program To Find The Integration of
4 (A) Given Below A MATLAB Program To Find The Integration of
4 (A) Given Below A MATLAB Program To Find The Integration of
n=5;
a=0;
b=1;
h=(b-a)/n;
m=0.5*(ft(a)+ft(b));
s=0;
for i=1:1:n-1
s=s+ft(a+i*h);
end
r=h*(m+s);
5. If
dy
=0.4 y0.1 x 2 and y(2)=3 write down a MATLAB program to find
dt
the solution for y using Eulers method. Take step size 0.005 and
0 x 5
10marks
B) Between function file and script file which file you can execute?
What are the similarities between them?
4 marks
Q=Av
Re=Ro*v*d/mi
u
f=64/R
e
5
6
1
0
1
2
1
4
Usually you submit the data sheet with the report by calculating each
individual cell of each column by calculator. Now, by using MATLAB
you can easily do the same task if you know some basic vector
operations. Using vectors write the commands in MATLAB, to calculate
each column
N.B. no need to show calculation, just write the vector operation for each
column.
Assume miu=1e-3, A=0.054, d=0.03, Ro=1000.
4 marks
D) let p is a vactor
P=[ 4 5 6 7 8];
Write a MATLAB program, that will give the sum of all the elements in
this vector.
5 marks
An ellipse with has a perimeter of P = 60 cm. write the proper MATLAB code
using subs function Determine a and b. relation between a and b is b=3a.
OR
Two matrices are given below. Assign them to two variables as shown. Then Write
a matlab code to perform elementwise multiplication and matrix multiplication
between them. Write a difference between vector and matrix in MATLAB
5 marks