How could I fix an error in line 4 ("not enough arguments") of my routine?
显示 更早的评论
function [dados, Vx, Vy] =PLineares(AP,ML,SR) pi=3.141592653589793238; z=1.645; n=length(AP); dt=SR/n; T=dt*n; %------------------------------------------ APcm=AP*100;MLcm=ML*100; dx=diff(abs(APcm));dy=diff(abs(MLcm)); for i=1:n-1 DOT_(i)=(APcm(i+1)-APcm(i))^2+(MLcm(i+1)-MLcm(i))^2; end DOT_AP= norm(APcm);DOT_ML= norm(MLcm); DOT = sqrt(DOT_AP^2+DOT_ML^2); %------------------------------------------ Vap=DOT_AP/T;Vml=DOT_ML/T;Vr=DOT/T; dx=diff(APcm); dy=diff(MLcm); %------------------------------------------ Vx=dx./dt;Vy=dy./dt; Vx(n)=Vx(n-1);Vy(n)=Vy(n-1); %**************************************** ACPap = max(APcm) - min(APcm); ACPml = max(MLcm) - min(MLcm); V = cov(APcm,MLcm); [vec,val] = eig(V); axes = 2.4478*sqrt(svd(val)); Area = pi*prod(axes); %-------------------------------------------------------------- dados(1)=DOT;dados(2)=DOT_AP; dados(3)=DOT_ML; dados(4)=ACPap;dados(5)=ACPml;dados(6)=Area; dados(7)=Vr; dados(8)=Vap;dados(9)=Vml; %-------------------------------------------------------------- %************************* %* Fim da Rotina %************************
3 个评论
Please, Borja, format your code properly. Consider that this advice has been given over thousands of times already and that it is in your interest to increase the readability of your question.
Please post the complete error message, most of all the line, which causes the problem.
Maria Perdomo
2013-6-24
编辑:Maria Perdomo
2013-6-24
Wich one is your line four?
function [dados, Vx, Vy] =PLineares(AP,ML,SR)
pi=3.141592653589793238;
z=1.645;
n=length(AP); %%%%IS THIS YOUR LINE FOUR?????
dt=SR/n;
T=dt*n;
%------------------------------------------
APcm=AP*100;
MLcm=ML*100;
dx=diff(abs(APcm));
dy=diff(abs(MLcm));
for i=1:n-1
DOT_(i)=(APcm(i+1)-APcm(i))^2+(MLcm(i+1)-MLcm(i))^2;
end
DOT_AP= norm(APcm);
DOT_ML= norm(MLcm);
DOT = sqrt(DOT_AP^2+DOT_ML^2)
%------------------------------------------
Vap=DOT_AP/T;
Vml=DOT_ML/T;
Vr=DOT/T;
dx=diff(APcm);
dy=diff(MLcm);
%------------------------------------------
Vx=dx./dt;Vy=dy./dt; Vx(n)=Vx(n-1);Vy(n)=Vy(n-1);
%****************************************
ACPap = max(APcm) - min(APcm);
ACPml = max(MLcm) - min(MLcm);
V = cov(APcm,MLcm);
[vec,val] = eig(V);
axes = 2.4478*sqrt(svd(val));
Area = pi*prod(axes);
%--------------------------------------------------------------
dados(1)=DOT;
dados(2)=DOT_AP;
dados(3)=DOT_ML;
dados(4)=ACPap;
dados(5)=ACPml;
dados(6)=Area;
dados(7)=Vr;
dados(8)=Vap;
dados(9)=Vml;
%--------------------------------------------------------------
%************************* %* Fim da Rotina %*********************
Borja
2013-6-24
回答(2 个)
Jan
2013-6-24
How did you call this program? Did you define the required input arguments? The correct calling method is typing this into the command window, a script or a function:
[dados, Vx, Vy] = PLineares(AP, ML, SR)
Maria Perdomo
2013-6-24
Borja,
you have to give values to AP ML and SR. For example:
[dados, Vx, Vy] = PLineares([1 2 3], [1 2 3], 3)
please notice that your code requires AP and ML to be the same size
类别
在 帮助中心 和 File Exchange 中查找有关 R Language 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!