Question:
How to plot successive (positive) powers of in MATLAB?
Answer:
The successive plots of can be done by following the steps below:
Create and anaonymous function of .
Create an array of positive numbers from to .
Plot anonymous function in using MATLAB built-in command "fplot".
As for every in the array, graphs are generated. Legends on graph plot can be shown using string and interpreter.
Define the bounds of graph plot in x-axis and y-axis using MATLAB built-in commands "xlim" and "ylim"
clear all; clc;close all;
n = 1:10;
figure(1);
f = @(x) x.^n;
fplot(f);
hold on;
legend("$x^{"+n+"}$", 'interpreter','latex','Location','Best')
xlim([-10 10])
ylim([-100 100])
grid on;
OUTPUT
0 Comments