Undefined function error using initial command

Every time I use the "initial" command on MATLAB (which I am required to use by my professor) I keep getting an error: Undefined function 'initial' for input arguments of type 'double'. What is causing this? From collaboration with other class mates I don't seem to have an error in my code.
clear all; close all; clc;
t=0:0.01:20;
A=[0 1 0 0;-2 -1 1 0; 0 0 0 1; 1 0 -1 -1];
B=[0 0 0 0]';
C=[0 1 0 0; 0 0 1 0];
D=[0;0];
q0 = [ 0 0 1 0];
[y,x,t]=initial(A,B,C,D,q0,t);
Y1= [1 0]*y';
Y2= [0 1]*y';
figure ( 1 )
plot ( t, Y1, 'k-', 'LineWidth', 2 )
set ( gca, 'FontSize', 16, 'FontName', 'Times New Roman' )
xlabel ( 'Time (s)' )
ylabel ( 'V_1(t) (m/s)' )
figure ( 2 )
plot ( t, Y2, 'k-', 'LineWidth', 2 )
set ( gca, 'FontSize', 16, 'FontName', 'Times New Roman' )
xlabel ( 'Time (s)' )
ylabel ( 'X_2(t)' )

回答(1 个)

It's not finding the "initial.m" file on your search path. Get your professor's "initial.m" file and put it into the folder where your m-file is living.

类别

帮助中心File Exchange 中查找有关 Entering Commands 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by