Undefined function 'qquadrature' for input arguments of type 'double'
Afficher commentaires plus anciens
Can you please help:
I have the following code in an .M file:
if true
`% free vibration of non-prismatic Euler beams with or without axial load
%using differential quadrature method
clc;
ne=50;
n=ne+1;
nn=2*n;
no=4;
m=zeros(n,1);
x=zeros(n,1);
xi=zeros(n,1);
c=zeros(n,n,no);
d=zeros(n+4,n+4);
e=zeros(n+4,n+4);
z=zeros(n+4,1);
f=zeros(n+4,1);
alp=zeros(n,n);
bet=zeros(n,n);
zz=zeros(n,1);
ki=zeros(n,n);
eta=zeros(n,n);
const=1.0;
l=12;
ymod=200e09;
rho=7800;
format long;
for i=1:n
xi(i)=0.5*(1-cos((i-1)*pi/ne));
%mi(i)=0.000038*(1-xi(i)^2/2);
ar(i)=1/rho;
mi(i)=0.000038;
ki(i,i)=ymod*mi(i);
end
c=qquadrature(xi,n,no);
%c = harquadrature(xi,n,no)
for i = 1:n
alp(i,i) = 0;
bet(i,i) = 0;
for j = 1:n
alp(i,i) = alp(i,i)+c(i,j,1)*ki(j,j)/l;
bet(i,i) = bet(i,i)+c(i,j,2)*ki(j,j)/l^2;
end
end
d=zeros(n+4,n+4);
% free vibration of the beam
% axial load on the beam t=+ if it is compressive t=- if it is tensile
% weight of the beam / unit length
t=520895.0;
d(1:n,1:n)=2.0*alp*c(:,:,3)/l^3+bet*c(:,:,2)/l^2+ki*c(:,:,4)/l^4+eta+t*c(:,:,2)/l^2;
% boundary conditions
% clamped - free
% d(n+1,1)=1.0;
% d(n+2:n+2,1:n)=alp(n,n)*c(n,1:n,2)/l^2+ki(n,n)*c(n,1:n,3)/l^3+t*c(n,1:n,1)/l;
% d(n+3:n+3,1:n)=c(1,1:n,1)/l;
% d(n+4:n+4,1:n)=ki(n,n)*c(n,1:n,2)/l^2;
% d(1,n+1)=1.0;
% for i=1:n
% d(i,n+2)=d(n+2,i);
% d(i,n+3)=d(n+3,i);
% d(i,n+4)=d(n+4,i);
% end
% pinned - pinned
d(n+1,1)=1.0;
d(n+2:n+2,1:n)=ki(n,n)*c(n,1:n,2)/l^2;
d(n+3:n+3,1:n)=ki(1,1)*c(1,1:n,2)/l^2;
d(n+4,n)=1.0;
d(n,n+4)=1.0;
d(1,n+1)=1.0;
d(n+4,n)=1.0;
for i = 1:n
d(i,n+2)=d(n+2,i);
d(i,n+3)=d(n+3,i);
end
e=zeros(n+4,n+4);
for i=1:n
e(i,i)=rho*ar(i);
end
z=d\e;
[ev,euv]=eig(z);
for i=1:n
zz(z)=ev(i,5);
end
omega=sqrt(1/euv(5,5));
sprintf(' natural frequency\n')
omega;
figure(1);
plot(xi,zz)
xlabel(' x/L ')
ylabel(' z')
title (' fundamental mode shape ')`
end
I have stored this file (Untitled.M) in the normal Matlab path, and therefore I'm assuming that Matlab will read the function when it's starting and that this function therefore should be available to use. Then I am trying to run this single M-files. But "Undefined function 'qquadrature' for input arguments of type 'double'" message appears.. Can somebody show me where's the problem and how ti fix it? Thankyou..
Réponses (1)
Mischa Kim
le 26 Mar 2014
Note, that qquadrature() is not a built-in MATLAB function. What does MATLAB return for
which qquadrature
If it is
'qquadrature' not found.
either the function is not on the path or it does not exist.
2 commentaires
Dewi Rasdiana
le 27 Mar 2014
fgttyfghfh dsfgdfg
le 25 Oct 2016
you can use this function i hope your problem will be solved
function[y]=qquadrature(x,n,no) m=zeros(n,1); c=zeros(n,n,4); for i=1:n m(i,1)=1; for k=1:n if ((k ==i )) jk=i; else m(i,1)=m(i,1)*(x(i)-x(k)); format long end end end for i=1:n for j=1:n if(j==i) jk=i; else c(i,j,1)=m(i,1)/((x(i)-x(j))*m(j,1)); end end end for i=1:n c(i,i,1)=0.0; for j=1:n if ((i==j)) jk=i; else c(i,i,1)=c(i,i,1)-c(i,j,1); end end end for o=2:no for i=1:n for j=1:n c(i,j,o)=0.0; for k=1:n c(i,j,o)=c(i,j,o)+c(i,k,1)*c(k,j,(o-1)); end end end end c(:,:,1); y=c;
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!