Predict the error, MATLAB will generate, in the following line of code: g = inline(‘3$^{x}$+5*x’, ‘t’)

Minh Phượng

New member
Predict the error, MATLAB will generate, in the following line of code:
g = inline(‘3$^{x}$+5*x’, ‘t’)
A. No error
B. Syntactical error
C. Wrong arguments
D. Expecting (,{ or [
 
Answer: a
Explanation: MATLAB will generate no error. But if we try to find an integral value of the function defined within the string argument, MATLAB will generate an error saying the variable t is defined. This is because we have used ‘x’ as the only variable within the string input. We can change‘t’ to ‘x’ or change the variable ‘x’ in the string input to ‘t’.
 

Tìm kiếm

Back
Top