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 vue (au cours des 30 derniers jours)
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 commentaire
Hamad Abdin
Hamad Abdin le 12 Nov 2020
Thank you so much..... That was so helpful...... and sorry for late respond.... thank you again

Connectez-vous pour commenter.

Réponses (1)

Rishabh Mishra
Rishabh Mishra le 8 Nov 2020
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.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by