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 个)
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!