Hi MATLAB, during our laboratory simulation, when we evaluate sin(x) when x=2, and use the "subs" command, some students reported the answer as sin(2) instead of 0.9093. How come? But when they use the "double" command, they arrived 0.9093. But other computers don;t need double command.
Case 1:
Script:
y=input('Input f(x): ');x=input('Input x for f(x): ');val=subs(y,x)Result:Input f(x): sin(x)Input x for f(x): 2val=sin(2)
Case 2:
Script:
y=input('Input f(x): ');x=input('Input x for f(x): ');val=subs(y,x)Result:Input f(x): sin(x)Input x for f(x): 2val=0.9093
Why did some computers reported sin(2) instead of 0.9093 with the same script? Why do some programs need double command but other computeres don't? Thank you
Best Answer