필터 지우기
필터 지우기

EZplot takes very long time to plot using, symbolic expression

조회 수: 2 (최근 30일)
Wilhelm Dahlin
Wilhelm Dahlin 2022년 2월 14일
답변: Sourav Karmakar 2022년 2월 17일
Hi all,
I'm having some difficult plotting graphs using EZplot. I dont know why but it has something to do with the matrix Ab. Before changing one element from "0" to "k1" in Ab, everything worked as it should and the plot appeard after 2 seconds - but after that small change it takes roughly 5 minutes for EZplot to plot the graphs. The script runs smoothly all the way to the start of the ezplot, I checked using "steps".
Below is the code. Am i missing something obvious or do I need to rewrite some of it?
m1=9;
m2=9;
m3=1;
k1=1;
k2=10;
k3=6;
syms t
Ab=[0 1 0 0 0 0; -k1/m1 0 k1/m1 0 0 0; 0 0 0 1 0 0; k1/m2 0 -(k1+k2)/m2 0 k2/m2 0; 0 0 0 0 0 1; 0 0 k2/m3 0 -(k2+k3)/m3 0];
x0=[1; 0; 0; 0; 0; 0];
eta=expm(t.*Ab);
ut=eta*x0;
u1=ut(1);
u2=ut(2);
v1=ut(3);
v2=ut(4);
w1=ut(5);
w2=ut(6);
%x1=u1, x2=v1, x3=w1
%Plot
figure(2)
ezplot(u1, [0, 50]);
ylim([-1.1, 1.1]);
hold on
ezplot(v1, [0, 50]);
ylim([-1.1, 1.1]);
ezplot(w1, [0, 50]);
ylim([-1.1, 1.1]);
legend('x(1)', 'x(2)', 'x(3)', 'Location', 'southeast')

답변 (1개)

Sourav Karmakar
Sourav Karmakar 2022년 2월 17일
Hey Wilhelm ,
When you are using ‘0’ instead of ‘k1’ in Ab matrix then your ‘u1’,’v1’,’w1’ will contain simpler symbolic expressions in comparison to other value of ‘k1’. That’s why, using “EZplot”, you will get your plot figures within few seconds.
While using ‘k1’, the symbolic expressions will be complex for those variables. Then, it will take longer time to plot the respective figures. “ezplot is not recommended, use fplot or fimplicit instead .
Hope this helps!

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by