Undefined function 'qquadrature' for input arguments of type 'double'

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..

답변 (1개)

Mischa Kim
Mischa Kim 2014년 3월 26일
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

I've searched the differential quadrature m-files on internet and I found this one http://www.mathworks.com/matlabcentral/fileexchange/7170-differential-quadrature-matrix/content/Diff_Quad.m but I know it won't work because in my case i have 3 variables (xi,n,no)..
So can please help me on how to develop this script..
I'll be appreciated with your help..
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;

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

제품

질문:

2014년 3월 26일

댓글:

2016년 10월 25일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by