How fplot legend works with four subplots of legendre functions?
3 views (last 30 days)
Show older comments
Hi, I have this code:
clear all
clc
syms x
f1(x)=legendreP(1,x);
f2(x)=legendreP(2,x);
f3(x)=legendreP(3,x);
f4(x)=legendreP(4,x);
subplot(2,2,1), fplot(f1,[-1 1]), title('Polinomio de grado 1')
grid on
xlabel('x')
ylabel('f(x)')
subplot(2,2,2), fplot(f2,[-1 1]), title('Polinomio de grado 2')
grid on
xlabel('x')
ylabel('f(x)')
subplot(2,2,3), fplot(f3,[-1 1]), title('Polinomio de grado 3')
grid on
xlabel('x')
ylabel('f(x)')
subplot(2,2,4), fplot(f4,[-1 1]), title('Polinomio de grado 4')
grid on
xlabel('x')
ylabel('f(x)')
I want to understand how it works the legend in this case. I cannot figure out how it is.
The idea here is plotting 4 differents legendre functions with different titles and legends in each subplot.
Actually, each first time that I run this code, Matlab show me this errors:
Warning: Error updating FunctionLine.
Second input must be a scalar or vector of unique symbolic variables.
Warning: Error updating FunctionLine.
Second input must be a scalar or vector of unique symbolic variables.
Warning: Error updating FunctionLine.
Second input must be a scalar or vector of unique symbolic variables.
Warning: Error updating FunctionLine.
Second input must be a scalar or vector of unique symbolic variables.
And I can't too figure out why this is happening, because the second time I run it, I get the graphic.
Could you, please, help me?
Thank you
Have a nice day.
Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!