the answer should be by matlab code Write an Mscript file en

the answer should be by matlab code

Write an M-script file entitled Probleml 7.m to do the following. Given we wish to solve Nxdx we will compare three approaches. First use the artificial time vector ith 0.01 sec increment to produce discrete values of the function, then integrate with trapz. Second, use the square root function and integrate with command quad. Display both results

Solution

The MATLAB script for performing the integration by using trapezoidal integration and by quad function is given below

-----------------------------------------------------------------------------------------------------------------------------------------------

x=0:0.01:1;
y=sqrt(x);
S=trapz(x,y)
f1 = inline(\'sqrt(x)\')

Q = quad(f1,0,1)

--------------------------------------------------------------------------------------------------------------------------------------------

>> Integration

S =

0.6665


f1 =

Inline function:
f1(x) = sqrt(x)


Q =

0.6667

S is result by trapexoidal integration and Q is by quad function

the answer should be by matlab code Write an M-script file entitled Probleml 7.m to do the following. Given we wish to solve Nxdx we will compare three approach

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site