- what is xRk
- For how many iterations of R you want to run the formula
- what is the purpose of AF function in this code?
Looking to write a code which utilises a formula to solve an equation
1 次查看(过去 30 天)
显示 更早的评论
clc
clear all
close all
AF = @(x) x^3-4x^2-1; % function equation
xR(R/2) = 46/x + 5(x-3); % iterative formula
x3 = 1;
Very new to MATLAB and was wondering how I would go about creating an iteration to output solutions to the problem.
2 个评论
Mehmed Saad
2020-4-13
编辑:Mehmed Saad
2020-4-13
回答(1 个)
Mehmed Saad
2020-4-13
k=100;
xR = zeros(1,k);
xR(1) =2; % Initial Guess
for i=2:k
xR(i) = 1+ (1/xR(i-1)); % iterative formula
end
Now xR is an array which contains the value for 100 iteration where each iteration value depends on previous one
6 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!