Newton Raphson equation trig functions
이전 댓글 표시
Trying to calculate root to an equation using newton raphson. also need to tabulate the results. the table isn't showing any info though.
clc
clear all
syms x
T = []; % Define table
x0 = .1; % Define Initial Value
i = 1; % Define Counter
N = 10; % Define max number of iterations
% Define Variables
S = 5281.716;
L = 5280;
f(x) = x - (S/L) * sin(x); % Define Function
df = diff(f); % Differential Function
while i <= N
x = x0 - (f(x0)/df(x0)); % Newton-Raphson Equation
if abs(x-x0) <= 10^-8
return
end
R = S/(2*x0); % Radius
d = R*(1-cos(x0)); % Distance d
T = [T; i x0 R d];
i = i + 1; % Increase Counter
x0 = x; % Update value of x0
vpa(x0) % Decimal
end
T = table(Iteration, Theta, Radius, d);
댓글 수: 5
John D'Errico
2018년 8월 31일
Homework? If not, then USE FZERO!
Derek Reitnouer
2018년 8월 31일
John D'Errico
2018년 8월 31일
You still have not answered my question. Is this homework? That is the only possible reason why you NEED to use Newton/Raphson, so the conclusion seems clear.
Derek Reitnouer
2018년 9월 2일
Muhammad Qasim
2021년 7월 5일
cos(x)+2sin(x)+x^2
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Newton-Raphson Method에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!