How fplot legend works with four subplots of legendre functions?

조회 수: 1 (최근 30일)
Jaime Vera
Jaime Vera 2017년 9월 30일
댓글: Walter Roberson 2017년 10월 1일
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.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by