Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Edit question THIS NEEDS TO BE ANSWERED IN MATLAB CODING ONLY please use screen

ID: 3868413 • Letter: E

Question

Edit question

THIS NEEDS TO BE

ANSWERED IN MATLAB CODING ONLY please use screen shots so I can follow along because these two questions have been answered, but I do not understand how it works!

See problems under image below....

I KNOW HOW TO CALCULATE ALL OF THESE PROBLEMS ALREADY I DON'T KNOW HOW TO CODE IN MATLAB, so if possible show me the steps so I understand, Thank you.

ALSO CAN YOU PLEASE ONLY USE ONE (1) function M FILE

CODE I USED (see below)

function [ result ] = myimproperintegral( f )
f=@(x)2*exp(-x)
    xmin = 3
i = 1

while i < inf
i = i+1
xmax = xmin + i
q1 = integral(f,xmin,xmax)
q2 = integral(f,xmin,xmax+1)
approx = q2 - q1
if approx < 0.01
    break
end


end
myimproperintegral = q2
end

RESULTS I GOT (see below)

myimproperintegral(@(x)5*exp(-1.75*x)): Extra Output AND No Result Returned +0
myimproperintegral(@(x)7/x^4.2): Extra Output AND No Result Returned +0
myimproperintegral(@(x)0.6*exp(-1.25*x)): Extra Output AND No Result Returned +0
myimproperintegral(@(x)2.8*exp(-1*x)): Extra Output AND No Result Returned +0
myimproperintegral(@(x)8/x^5.8): Extra Output AND No Result Returned +0
myimproperintegral(@(x)8/x^5.6): Extra Output AND No Result Returned +0
myimproperintegral(@(x)9/x^5.8): Extra Output AND No Result Returned +0
myimproperintegral(@(x)6/x^5.4): Extra Output AND No Result Returned +0
myimproperintegral(@(x)3.1*exp(-1.75*x)): Extra Output AND No Result Returned +0
myimproperintegral(@(x)9/x^4.8): Extra Output AND No Result Returned +0

can someone please help I need to turn this in on 8/16/2018 (Tuesday, @5pm EST,USA)

Math 206 Spring 2017 Project 3 What to Submit: Generated For: For this project you will need to create and upload four function m-files. Grading Method: run a variety of data throug For grading we will h your function m-hles. Each m-hle will earn credit based up how many correct values it returns. For example if we test it on 10 sets of input and it returns 7 correct values it would earn 70%. Very Important Note: Your functions should print absolutely nothing (no disp and please do use semicolons to suppress calculation outputs) and should only return the value requested. The returned value will be displayed automatically as a result of being returned from the function Another Very Important Note: Please do not try to find Matlab functions which do these things for you. The point of these projects is to practice the material from the tutorials and so trying to use obscure Matlab functions which shortcut the whole process means you're not really doing what the project is trying to test. If you're not sure about whether you can or cannot use some specific Matlab function for a project please ask me Sample Data: See the sample data (also in this directory) to see some sample input and output.

Explanation / Answer

I hope you are allowed to use integral() function for this assignment. Since you have used the function, I presume you are allowed. Otherwise you will have to define your own integral function based on some methods like Trapezoidal rule or so.

Please save the following code in a file named myimproperintegral.m

function result = myimproperintegral(f)
xstart = 3;
xend = 4;
  
approx1 = integral(f, xstart, xend);
  
while true
xend = xend + 1;
approx2 = integral(f, xstart, xend);
diff = approx2 - approx1;
  
if diff < 0 %convert a -ve difference to +ve
diff = -diff;
end
  
if diff < 10^-2
break
end

approx1 = approx2;
end
  
result = approx2;
end
  

============================

Now, to use the fuction we created: At the prompt, type

f=@(x)2*exp(-x)
myimproperintegral(f)

Hope it helps. If it does, request you to rate the answer . Thank you.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote