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 view (last 30 days)
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);

Answers (1)

Rishabh Mishra
Rishabh Mishra on 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.

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!