Borrar filtros
Borrar filtros

How to plot? Having a issue.. Need to plot evolution of the norm of a symbolic matrix for t=0 to 1.

4 visualizaciones (últimos 30 días)
syms t
PHI=[ 1, t, t/3 - (2*exp(-3*t))/9 + 2/9, (2*t)/3 + (2*exp(-3*t))/9 - 2/9;
0, 1, (5*exp(-3*t))/12 - (3*exp(t))/4 + 1/3, 2/3 - exp(t)/4 - (5*exp(-3*t))/12;
0, 0, exp(-3*t)/4 + (3*exp(t))/4, exp(t)/4 - exp(-3*t)/4;
0, 0, (3*exp(t))/4 - (3*exp(-3*t))/4, (3*exp(-3*t))/4 + exp(t)/4];
N=norm(PHI);
t=0:0.00001:1;
plot(t,N)
Answer:
Error using plot
Data must be numeric, datetime, duration or an array
convertible to double.
Error in Q22 (line 8)
plot(t,N)

Respuestas (3)

Stijn Haenen
Stijn Haenen el 7 de Dic. de 2019
you should use fplot or ezplot (https://nl.mathworks.com/help/symbolic/ezplot.html) to plot a 'sym' variable.

Shauvik Das
Shauvik Das el 7 de Dic. de 2019
syms t
PHI=[ 1, t, t/3 - (2*exp(-3*t))/9 + 2/9, (2*t)/3 + (2*exp(-3*t))/9 - 2/9;
0, 1, (5*exp(-3*t))/12 - (3*exp(t))/4 + 1/3, 2/3 - exp(t)/4 - (5*exp(-3*t))/12;
0, 0, exp(-3*t)/4 + (3*exp(t))/4, exp(t)/4 - exp(-3*t)/4;
0, 0, (3*exp(t))/4 - (3*exp(-3*t))/4, (3*exp(-3*t))/4 + exp(t)/4];
N=norm(PHI);
ezplot(N,[0,1])
Still showing error:
Dimension argument is not supported when two input
arrays are provided.
Error in inline/feval (line 33)
INLINE_OUT_ = inlineeval(INLINE_INPUTS_,
INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error in ezplotfeval (line 51)
z = feval(f,x(1));
Error in ezplot>ezplot1 (line 486)
[y, f, loopflag] = ezplotfeval(f, x);
Error in ezplot (line 158)
[hp, cax] = ezplot1(cax, f{1}, vars,
labels, args{:});
Error in sym/ezplot (line 78)
h = ezplot(fhandle(f),varargin{:});%#ok<EZPLT>
Error in Q2 (line 10)
ezplot(N,[0,1]);

Stijn Haenen
Stijn Haenen el 7 de Dic. de 2019
Your PHI is a 4x4 matrix, do you want to plot 16 function against t?
That can be done with:
syms t
PHI=[ 1, t, t/3 - (2*exp(-3*t))/9 + 2/9, (2*t)/3 + (2*exp(-3*t))/9 - 2/9 ;
0, 1, (5*exp(-3*t))/12 - (3*exp(t))/4 + 1/3, 2/3 - exp(t)/4 - (5*exp(-3*t))/12 ;
0, 0, exp(-3*t)/4 + (3*exp(t))/4, exp(t)/4 - exp(-3*t)/4 ;
0, 0, (3*exp(t))/4 - (3*exp(-3*t))/4, (3*exp(-3*t))/4 + exp(t)/4 ];
fplot(PHI,t)
I dont know what you want with the norm function, this norm does not work.

Categorías

Más información sobre Get Started with Symbolic Math Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by