how can i solve this proplem? its keep saying not enough input argument when i put the plot option

1 次查看(过去 30 天)
close all;
clear all; %#ok<CLSCR>
clc;
syms t y(t);
m=input('specify the power value');
u=(t.*sin(3.*t)).^m;
z=int(u,0,exp(t));
w=diff(u,t,2);
a=laplace(w);
dy1=diff(y,t,1);
dy2=diff(y,t,2);
L=length(m);
y(t)=dsolve(dy2-(5*dy1)+(4*y)==randi([1,L]),dy2==0,dy1(0)==0);
q=laplace(y(t));
subplot(1,6,1),ezplot (u);
subplot(1,6,2),ezplot (z);
subplot(1,6,1),ezplot (w);
subplot(1,6,2),ezplot (y(t));
subplot(1,6,2),ezplot (q);
subplot(1,6,1),ezplot (a);

回答(1 个)

Johnathan Schaff
Johnathan Schaff 2018-3-12
Your code ran on my machine, but the error you posted seemed to point to the ezplot function. Looking at the documentation for ezplot, the two types of inputs that it supports are function handles and character vectors. However, there is another version of the ezplot function specific to the symbolic toolbox that will support sym input. You could try using the fplot function in place of ezplot to plot symbolic functions, but that could also run into the same problem. An alternative could be to utilize the subs function and evaluate over a specified range
figure()
range = -5:0.01:5; %Typical numerical evaluation for fplot
plot(range,eval(subs(u,range)))%Where u is a symbolic expression

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by