フィルターのクリア

How to plot a stored vector on one graph with the x axis 1:number

4 ビュー (過去 30 日間)
Jason Long
Jason Long 2016 年 10 月 24 日
回答済み: Chaya N 2016 年 10 月 24 日
clear; close all; clc;
number = input('What is your number? ');
Estimate = input('What is your estimate? ');
Err = abs(Estimate ^ 5 - number);
count = 0;
i = 1;
v = [0];
while Err >= 0.00001
v(i) = Estimate;
i = i + 1;
Estimate = Estimate - (Estimate ^ 5 - number) / (5 * Estimate ^ 4);
Err = abs(Estimate ^ 5 - number);
count = count + 1;
end
p = [1:1:number];
plot(p,v);
root5 = number ^ (1 / 5);

採用された回答

Chaya N
Chaya N 2016 年 10 月 24 日
Try the following
plot(1:numel(v),v);

その他の回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by