2016/11/02

Matlab: Draw an Exponential Function with exp() with a custom Y-axis at x = 0

>> x = -2:0.2:4; %incrementing by 0.2 from -2 to 4.
>> y = exp(x);
>> plot(x,y);
>> ax = gca; %Axis
>> ax.YAxisLocation = 'origin'; %Y axis at x = 0.
>> title('Exponential Function', 'FontSize', 16); %Add title to plot with custom font size

Result:


Related Information:

Exponential Function & Natural Logarithm 指數函數與自然對數
Display Axis Lines Through Origin (MathWorks)

沒有留言:

張貼留言