Question

Write MATLAB code

g(x)=x+a*f(x)

f(x)=(e^x)+(x^2)-x-4

function f(x) is stored in fogp1.m


(c) (1) Create a file gopgi.m to calculate the function glir, a) (see Preparation, ex. 7c) function [y] =gopg1(x,a) % input:

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

`Hey,

Note: If you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

clc%clears screen
clear all%clears history
close all%closes all files
format long
x0=1.3;
a=-0.3;
for i=1:100
x1=gopg1(x0,a);
fprintf('Iteration %d, x is %f\n',i,x1);
if(abs((x1-x0)/x0)<1e-8)
break;
end
x0=x1;
end


function y=gopg1(x,a)
y=x+a.*(exp(x)+x.^2-x-4);
end

- O X Pradeep do E C . Search Documentation Aduan RUN MATLAB R2018a HOME PLOTS D E L Find Files 3 Compare - New Open Save Pri

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Write MATLAB code g(x)=x+a*f(x) f(x)=(e^x)+(x^2)-x-4 function f(x) is stored in fogp1.m (c) (1) Create a file...
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
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