Undefined function or method 'V' for input arguments of type 'double'.
6 views (last 30 days)
Show older comments
Ahmed Touhami
on 20 Mar 2016
Commented: Ahmed Touhami
on 21 Mar 2016
Hi There. I'm getting the following error when I try to run this programme. *Undefined function or method 'V' for input arguments of type 'double'.*
%Mesures=importdata('C:\Users\wrd\Documents\Données du moteur\AR-Variat charge _(ess2-01-07)\D1500_20%.dat');
Mesures=importdata('C:\Users\wrd\Documents\Données du moteur\AR-Variat charge _(ess2-01-07)\D1500_20%.dat');
thet=Mesures(:,1);
%theta=thet;
theta=Mesures(1:5:numel(thet),1);
%Pres=10^5*Mesures(1:numel(theta),2);
P=10^5*Mesures(1:5:numel(thet),2);
%dPthet=gradient(P,theta); %dPthet=10^5*Mesures(:,2);
% P(1)=Pres(1); P(2)=Pres(2); P(numel(theta))=Pres(numel(theta)); P(numel(theta)-1)=Pres(numel(theta)-1);
% for i=3:(numel(theta)-2)
% P(i)=(Pres(i-2)+Pres(i-1)+Pres(i)+Pres(i+1)+Pres(i+1))/5;
% end
dPtheta=gradient(P,theta);
%débit d'air
dVN=40; %[Nm3/h]
r=300;
Pad=100000;
Tad=273.15;
dm=(dVN*Pad)/(r*Tad*3600); %[Kg/s]
m=(dm*60)/(2*N);
% m=6*10^(-4);
%stop
Qcumul=zeros(numel(P),1);
% Angle de début et bde fin de calcul du dégagement de chaleur
AngPMH_comp=0; %***TRES IMPORTANT : Si le cycle commence de 0 prendre 360 si il commence de -360 prendre 0
thetmax=AngPMH_comp+70;
for i=2:numel(theta)
%Calcul du volume et de sa dérivée
clear V
[VL(i),dVthet(i)]=V(theta(i),Cu,Vm,Landav);
end
%plot(theta,dPtheta); plot(theta,dQthet_app,'r'); axis([AngPMH_comp-20 thetmax -10 60]);grid on;hold on;
0 Comments
Accepted Answer
John D'Errico
on 20 Mar 2016
One would have no idea what you expected from this code. MATLAB certainly had no idea.
READ THE ERROR MESSAGE. It points out that V is undefined. In fact, inside a loop, you use the function or variable V.
clear V
[VL(i),dVthet(i)]=V(theta(i),Cu,Vm,Landav);
Even worse, on the very line before you try to use V, you clear it!
If you want to use V as a function or variable, it needs to exist. If not, then MATLAB will (and should) throw up its virtual hands and give up the ghost.
3 Comments
John D'Errico
on 21 Mar 2016
Edited: John D'Errico
on 21 Mar 2016
It does not exist. There is no function named V, at least not on the MATLAB search path.
help addpath
There is NO reason to clear V. That is a waste of time.
I think it is time for you to start learning MATLAB.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!