For this question, my graph didn't appear anything... Can anyone help me to solve this problem??

2 views (last 30 days)
Here's my code:
function myf(x)
for x= [-10 -7 0 2.4 5 6 10]
f= (5.*x.^3 + 15.*x.^2 + x + 10).*sin(x)
y=f^-1
x1= x - f/y
end
z=plot(x1,f)
end

Accepted Answer

Sam Chak
Sam Chak on 13 Dec 2022
Edited: Sam Chak on 13 Dec 2022
If you want to plot the function over a region , then you can try something like this.
x = linspace(-10, 10, 1001);
y = myf(x);
plot(x, y), grid on, xlabel('x'), ylabel('f(x)')
% Setup your math function
function y = myf(x)
y = (5*x.^3 + 15*x.^2 + x + 10).*sin(x);
end
  2 Comments
Muhammad Huzayl Rais
Muhammad Huzayl Rais on 13 Dec 2022
Hi, sir thanks for helping me, but I still couldn't understand this 'Use Newton's Method to find the solution to the equation below to the accuracy of 10−7. '
Sam Chak
Sam Chak on 13 Dec 2022
Thought your original problem is about making the graph "appears".
Can you lookup the MATLAB code for Newton's Method (on Google) and post it here?
It makes troubleshooting your problem easy for you and me.
Just make sure you edit the Newton's code to fit your mathematical problem.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!