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

can someone show me how todo this. please put comments in code to explain what y

ID: 2081701 • Letter: C

Question

can someone show me how todo this. please put comments in code to explain what your are doing in the lines.
I'm using matlab.


32, One numerical method for calculating the cubic root of a number VP is Hal. solution process starts by choosing a value as a first esti. The ley's method. mate of the solution. Using this value, a second, more accurate value x is calculated with x x, (xi 2P) (2xi P), which is then used for calculating a a third, still more accurate value x and so on. The general equation for calculat. ing the value of x 1 from the value of xi is x +1 x(x 2P) (2x +P) Write a MATLAB program that calculates the cubic root of a number. In the program use xt P for the first estimate of the solution. Then, by using the general equation in a loop, calculate new, more accurate values. Stop the looping when the estimated relative error E defined by E is smaller than 0.00001. Use the program to calculate (a) V800 (b) V59071 (c) 31.55

Explanation / Answer

answer for

a)  9.2832=(800)^(1/3)

b) 38.9456=59071^(1/3)

c) -3.1599=(-31.55)^(1/3

code

clc
close all;
P=input ('enter the value of the number');
% x1=input('the first estimate of root');
x1=P;%choosing initial estimate
i=1:1:100;%choosing the number of iteration

x=zeros(1,length(i));%defining the length of x matrix
x(1)=x1;%initializing the first root as x1

for ii=1:1:length(i);
  
x(ii+1)=x(ii)*(x(ii)^3+2*P)/(2*x(ii)^3+P);%formula for finding root
  
E=abs((x(ii+1)-x(ii))/x(ii));%error for root
if E<0.00001 %using the if condition and break statement for terminating the loop when condition mets
break

end
Result=x(ii+1);

end
display (Result)

you can choose any initial value except zero in your question initial estimate is written as P

so i have choosen initial estimate as P

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