I am trying to give an option (in row 15) of making sure you selected the right option. so, I wrote disp('if that correct type (1) if is not correct type(2) and it seem is not working. please help.

1 回表示 (過去 30 日間)
disp('0. Graphical')
disp('1. Incremental Search')
disp('2. Bisection Method')
disp('3. False Position Method')
disp('4. Fixed Point Iteration')
disp('5. Newton Raphson')
disp('6. Secant')
disp('7. Modified Secant')
disp('__________________________________')
disp(' ')
meth = input('Select Method (0 through 7):');
switch meth
case 0
disp(' ')
disp('You been Have Selected Graphical Method')
disp('if that Correct type (1) if is not correct type (2)')
func = input('Primary Function (@(x)):');
if isempty(func)
error('Must Enter a Function. Start again.'),
end
xL = input('Lower Interval Limit: ');
if isempty(xL)
error('Must Enter a Lower Limit. Start again. ');
end
xU = input('Upper Interval Limit: ');
if isempty(xU)
error('Must Enter an Upper limit. Start again.'),
end
bounds = [xL xU];
fplot(func, bounds);
  1 件のコメント
Hamad Abdin
Hamad Abdin 2020 年 11 月 12 日
Thank you so much..... That was so helpful...... and sorry for late respond.... thank you again

サインインしてコメントする。

回答 (1 件)

Rishabh Mishra
Rishabh Mishra 2020 年 11 月 8 日
Hi,
Use the code below to work out the issue you are facing.
disp('0. Graphical')
disp('1. Incremental Search')
disp('2. Bisection Method')
disp('3. False Position Method')
disp('4. Fixed Point Iteration')
disp('5. Newton Raphson')
disp('6. Secant')
disp('7. Modified Secant')
disp('__________________________________')
disp(' ')
meth = input('Select Method (0 through 7):');
switch meth
case 0
disp(' ')
disp('You been Have Selected Graphical Method')
isCorrect = 2;
while(isCorrect == 2)
isCorrect = input('if that Correct type (1) if is not correct type (2)');
end
func = input('Primary Function (@(x)):');
if isempty(func)
error('Must Enter a Function. Start again.'),
end
xL = input('Lower Interval Limit: ');
if isempty(xL)
error('Must Enter a Lower Limit. Start again. ');
end
xU = input('Upper Interval Limit: ');
if isempty(xU)
error('Must Enter an Upper limit. Start again.'),
end
bounds = [xL xU];
fplot(func, bounds);
end
Hope this helps.

カテゴリ

Help Center および File ExchangeNewton-Raphson Method についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by