How could I fix an error in line 4 ("not enough arguments") of my routine?
Mostrar comentarios más antiguos
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 comentarios
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
el 24 de Jun. de 2013
Editada: Maria Perdomo
el 24 de Jun. de 2013
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
el 24 de Jun. de 2013
Respuestas (2)
Maria Perdomo
el 24 de Jun. de 2013
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
Categorías
Más información sobre R Language en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!