incorrect number of input arguments
22 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Heya :)
am 29 Dez. 2020
Bearbeitet: Cris LaPierre
am 29 Dez. 2020
Please help me to resolve what I am doing wrong in my title command.
clear all; close all; clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Simulation %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%value of constants
a1=0.2;a2=0.3;
omega1=5;omega2=4;
G=1;C12=0.01;C21=0.02;
dt=0.01; %step size
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x1(1)=0.5;
y1(1)=0.5;
x2(1)=0.5;
y2(1)=0.5;
for i=2:1000
x1(i)=x1(i-1)+((a1-x1(i-1)^2-y1(i-1)^2)*x1(i-1)-omega1*y1(i-1)+G*C12*(x2(i-1)-x1(i-1)))*dt;
y1(i)=y1(i-1)+((a1-x1(i-1)^2-y1(i-1)^2)*y1(i-1)+omega1*x1(i-1)+G*C12*(y2(i-1)-y1(i-1)))*dt;
x2(i)=x2(i-1)+((a2-x2(i-1)^2-y2(i-1)^2)*x2(i-1)-omega2*y2(i-1)+G*C21*(x1(i-1)-x2(i-1)))*dt;
y2(i)=y2(i-1)+((a2-x2(i-1)^2-y2(i-1)^2)*y2(i-1)+omega2*x2(i-1)+G*C21*(y1(i-1)-y2(i-1)))*dt;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Observation %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N_measurements=31;
N_basis=31;
index=randi([100,999],1,N_measurements);
Xdot1=zeros([1,N_measurements]);
Ydot1=zeros([1,N_measurements]);
Xdot2=zeros([1,N_measurements]);
Ydot2=zeros([1,N_measurements]);
for ni=1:N_measurements
Xdot1(ni)=(x1(index(ni)+1)-x1(index(ni)))/dt;
Ydot1(ni)=(y1(index(ni)+1)-y1(index(ni)))/dt;
Xdot2(ni)=(x2(index(ni)+1)-x2(index(ni)))/dt;
Ydot2(ni)=(y2(index(ni)+1)-y2(index(ni)))/dt;
end
M=zeros([N_measurements,N_basis]);
for i=1:N_measurements
for j=1:N_basis
if j==1
M(i,j)=1;
elseif j==2
M(i,j)=x1(index(i));
elseif j==3
M(i,j)=y1(index(i));
elseif j==4
M(i,j)=x2(index(i));
elseif j==5
M(i,j)=y2(index(i));
elseif j==6
M(i,j)=x1(index(i))^2;
elseif j==7
M(i,j)=x2(index(i))^2;
elseif j==8
M(i,j)=y1(index(i))^2;
elseif j==9
M(i,j)=y2(index(i))^2;
elseif j==10
M(i,j)=x1(index(i))*x2(index(i));
elseif j==11
M(i,j)=x1(index(i))*y1(index(i));
elseif j==12
M(i,j)=x1(index(i))*y2(index(i));
elseif j==13
M(i,j)=x2(index(i))*y1(index(i));
elseif j==14
M(i,j)=x2(index(i))*y2(index(i));
elseif j==15
M(i,j)=y1(index(i))*y2(index(i));
elseif j==16
M(i,j)=x1(index(i))^3;
elseif j==17
M(i,j)=y1(index(i))^3;
elseif j==18
M(i,j)=x2(index(i))^3;
elseif j==19
M(i,j)=y2(index(i))^3;
elseif j==20
M(i,j)=x1(index(i))^2*x2(index(i));
elseif j==21
M(i,j)=x1(index(i))^2*y1(index(i));
elseif j==22
M(i,j)=x1(index(i))^2*y2(index(i));
elseif j==23
M(i,j)=x2(index(i))^2*x1(index(i));
elseif j==24
M(i,j)=x2(index(i))^2*y1(index(i));
elseif j==25
M(i,j)=x2(index(i))^2*y2(index(i));
elseif j==26
M(i,j)=y1(index(i))^2*x1(index(i));
elseif j==27
M(i,j)=y1(index(i))^2*x2(index(i));
elseif j==28
M(i,j)=y1(index(i))^2*y2(index(i));
elseif j==29
M(i,j)=y2(index(i))^2*x1(index(i));
elseif j==30
M(i,j)=y2(index(i))^2*x2(index(i));
else
M(i,j)=y2(index(i))^2*y1(index(i));
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RIP %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Norms=zeros([1,N_basis]);
for j=1:N_basis
Norms(j)=norm(M(:,j));
end
for i=1:N_measurements
for j=1:N_basis
M(i,j)=M(i,j)/Norms(j);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
lambda=0.001;
Xdot1=Xdot1';
cd 'E:\MATLAB\bin\cvx\cvx'
cvx_setup
cvx_begin
variable ksaix1(31);
minimize(norm(M*ksaix1-Xdot1)+ lambda*norm(ksaix1,1));
cvx_end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ydot1=Ydot1';
cvx_setup
cvx_begin
variable ksaiy1(31);
minimize(norm(M*ksaiy1-Ydot1)+ lambda*norm(ksaiy1,1));
cvx_end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Xdot2=Xdot2';
cvx_setup
cvx_begin
variable ksaix2(31);
minimize(norm(M*ksaix2-Xdot2)+ lambda*norm(ksaix2,1));
cvx_end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ydot2=Ydot2';
cvx_setup
cvx_begin
variable ksaiy2(31);
minimize(norm(M*ksaiy2-Ydot2)+ lambda*norm(ksaiy2,1));
cvx_end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RIP %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for j=1:N_basis
ksaix1(j)=ksaix1(j)/Norms(j);
ksaiy1(j)=ksaiy1(j)/Norms(j);
ksaix2(j)=ksaix2(j)/Norms(j);
ksaiy2(j)=ksaiy2(j)/Norms(j);
end
ksaix1
ksaiy1
ksaix2
ksaiy2
figure
hold on
plot(x1,'r')
plot(x2,'g')
title('a1 = 0.2','Observation 1');
%%%Error%%%
Error using title (line 21)
Incorrect number of input arguments
Error in Two_Coupled (line 165)
title('a1 = 0.2','Observation 1');
0 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 29 Dez. 2020
Bearbeitet: Cris LaPierre
am 29 Dez. 2020
You have too many inputs to title, just like the error message says.
You are likely trying to create a title and subtitle, but this syntax was introduced in R2020b. You can see it is not mentioned in the R2020a documentation for title. What version of MATLAB are you using?
0 Kommentare
Weitere Antworten (1)
Walter Roberson
am 29 Dez. 2020
https://www.mathworks.com/matlabcentral/answers/26174-break-title-into-multiple-lines#answer_34191
0 Kommentare
Siehe auch
Kategorien
Mehr zu Title finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!