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

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Sam Chak
Sam Chak il 13 Dic 2022
Modificato: Sam Chak il 13 Dic 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 Commenti
Muhammad Huzayl Rais
Muhammad Huzayl Rais il 13 Dic 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 il 13 Dic 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.

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by