MATLAB Answers

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

1 view (last 30 days)
Mohammad Adeeb
Mohammad Adeeb on 10 Mar 2018
Answered: Johnathan Schaff on 12 Mar 2018
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);

Answers (1)

Johnathan Schaff
Johnathan Schaff on 12 Mar 2018
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

Tags

Community Treasure Hunt

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

Start Hunting!