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 Center および File ExchangeAssumptions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by