Question

Please solve using MATLAB. Will rate

Problem 4; Applications of functions in numerical computations The probability of occurrence based on a normalized Gaussian distribution requires the evaluation of the following integral with the aid of the built-in function integral, plot the above function o the domain 0szs5. Plot on the same graph the above function by evaluating the integral using the RightRiemannSum function. Critical thinking: For this problem, it might be easier to use the plot function than the fplot function. But either approach will work. To use plot, one needs to generate a set of data points of the function versus the discretized z values. To use fplot, one needs to properly define the probability function

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

The MATLAB code for plotting both curves is given below. It contains the usage of another functioned that is used to calcuate the Right Riemann Sum which is to be defined in another file named rsum_1.m . The corresponding code is given further below. The resulting plot is attached.

fun=@(x)exp(-x.^2/2); %function defined in terms of variable x
k=1;
f=zeros(1,21);
g=zeros(1,21);
for z=0:0.25:5 %step-size taken as 0.25 to plot enough number of points
f(k)=integral(fun,0,z)/sqrt(2*pi); %gaussian distribution evaluated using 'integral'
g(k)=rsum1(fun,0,z,20)/sqrt(2*pi); %gaussian distribution evaluated using Right Riemann Sum
k=k+1;
end
xaxis=linspace(0,5,21); %generate 21 equally spaced points between 0 and 5
plot(xaxis,f) % plot the gaussian curve(integral) against this vector
hold on; % hold on to plot another curve
plot(xaxis,g) % plot gaussian curve (riemann sum) against this vector
xlabel('z'); %define labels of the axes
ylabel('f(z)');

rsum_1.m

function value=rsum_1(Fun,a,b,number)
%a and b are the lower and upper limits of function to be approximated reepectively
%number is step-size of approxiamting the integral(number of rectangles)
delx=(b-a)/number; %width of the rectangle
Rsum=0;
for j=1:number
Rsum=Rsum+vpa(feval(Fun,a+(j)*delx))*delx; %evaluates the function at right-end point (a+dx,a+2dx,a+3dx...) %and adds it to resuls
end
value=Rsum;
end

The blue curve corresponds to the function evaluated using integral and the red curve belongs to the function evaluated using Right Riemann Sum.

0.5 0.45 0.4 0.35 0.3 0.25 0.2 0.15 0.1 0.05 0 0 0.5 1.5 2.5 3 3.5 4.5

Add a comment
Know the answer?
Add Answer to:
Please solve using MATLAB. Will rate Problem 4; Applications of functions in numerical computations The probability...
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
  • please do this problem in matlab and show me the code. Thanks. please do this problem...

    please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks.please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me...

  • please do this problem in matlab and show me the code. Thanks. please do this problem...

    please do this problem in matlab and show me the code. Thanks. please do this problem in Matlab and show me the code. Thanks. Problem #1: Circuits and linear-systems In the last HW you developed the governing equations for the “Wheatstone”-bridge circuit used extensively in engineering applications (shown below). B R R2 A D G m RA с E The resulting equations were solved for the output voltage and currents using the function: function [V_out, I_vector] =Wheatstone_bridge (v_in, R_vector) In...

  • Numerical Methods for Engineers and Scientists 3rd Edition – An Introduction with Applications Using MATLAB -...

    Numerical Methods for Engineers and Scientists 3rd Edition – An Introduction with Applications Using MATLAB - Gilat | Subramaniam Problem 3.29 A quarterback throws a pass to his wide receiver running a route. The quarterback releases the ball at a height of hQ . The wide receiver is supposed to catch theball straight down the field 60 ft away at a height of h R . The equation that describes the motion of the football is the familiar equation of...

  • Using MATLAB, please solve questions 5 and 6. 5. Basic integration TV2 Show that tan 1...

    Using MATLAB, please solve questions 5 and 6. 5. Basic integration TV2 Show that tan 1 = (sin? x dx = SV1- x? dx. 0 6. Integration with simple probability application The results x of a certain biological test are found to be normally distributed, with an average value u of 800 and a standard deviation o of 100. We can define zo = (x – u)/o as a measure of the number of standard deviations from the mean that...

  • matlab The error function is a mathematical function that frequently arises in probability and statistics. It also c...

    matlab The error function is a mathematical function that frequently arises in probability and statistics. It also can show up in the solution to some partial differential equations, particularly those arising in heat and mass transfer applications. The error function is defined as 2 e-t dt picture attached This function is actually built-in to MATLAB as the command erf, and here we'll use that function to compute a "true value" with which we can compare results of two interpolation approaches....

  • Please solve these using matlab Problem 1 Given the transfer functions e S +5 (a) C(s)...

    Please solve these using matlab Problem 1 Given the transfer functions e S +5 (a) C(s) 20 S + 20 (b) Use the step function to determine the time constant and rise time for each system. Note: estimate these values from the plot and do not use the stepinfo function. Problem 2 Given the transfer function 100 G(S) = 22 +45 + 25 a. Use the plot resulting from the step function in MATLAB to determine the percent overshoot, settling...

  • QUESTION 5 please. 4. MATLAB can solve second order equations numerically, but it needs to convert...

    QUESTION 5 please. 4. MATLAB can solve second order equations numerically, but it needs to convert it to a sys- tem first. We haven't covered systems yet, but we can make use of them (entirely in MAT- LAB) to solve this problem. The help page https://www.mathworks.com/help/symbolic/ solve-differential-equation-numerically-1.html shows how to do this. Follow those steps to get the solution to day +9y = cos(3) dt2 y(0) = 0 v(0) = 0 Plot this and your solution from the previous part...

  • 4. MATLAB can solve second order equations numerically, but it needs to convert it to a...

    4. MATLAB can solve second order equations numerically, but it needs to convert it to a sys- tem first. We haven't covered systems yet, but we can make use of them (entirely in MAT- LAB) to solve this problem. The help page https://www.mathworks.com/help/symbolic/ solve-differential-equation-numerically-1.html shows how to do this. Follow those steps to get the solution to day +9y = cos(3) dt2 y(0) = 0 v(0) = 0 Plot this and your solution from the previous part on the same...

  • Please solve problem 4 and 5 using matlab and include the screenshot of the result ,...

    Please solve problem 4 and 5 using matlab and include the screenshot of the result , thank you Homework #8 Applied Programming, ENGR 10573 Spring 2018 Due Monday, Apr. 2 uploaded through TCU Online by 11:59 PM. Upload one script or function, named studentlastn ame-homework 8 ) n a single m- file that runs each problem. The homework problems should run sequentially showing I figure and or plots along with the proof that each problem works correctly. The single m-file...

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