What does the following code do? [code]syms m,y,x,c; y=mx+c; diff(y)[/code]

What does the following code do?
Code:
syms m,y,x,c;
y=mx+c;
diff(y)
A. Calculate m
B. Calculate slope
C. Error
D. Calculate divergence
 
Answer: c
Explanation: While using syms, we can’t instantiate multiple symbolic variables using a comma. We will have to enter them with space in between. Hence MATLAB returns an error. If we remove the comma, the code will calculate the slope of ‘y=mx+c’.
 

Tìm kiếm

Back
Top