What is the output of the following code? [code]t=[-2:1:2];plot(t,exp(t));ax=gca;ax.Yscale=’Log’;[/code]

What is the output of the following code?
Code:
t=[-2:1:2];plot(t,exp(t));ax=gca;ax.Yscale=’Log’;
A. Error
B. An exponential graph
C. A logarithmic function
D. A ramp function
 
Answer: d
Explanation: The scale of the y-axis is changed to a logarithmic nature. But an exponential function is plotted in the y-axis and hence the graph is being approximated to a straight line which follows the interval of the input only.
 

Tìm kiếm

Back
Top