登录论坛

查看完整版本 : [求助]delphi与matlab接口


lpokmnj
2008-12-09, 10:45
大家好,我是个新手,今天编了这样一个程序,想获得与delphi的动态链接库,请问如何获得啊?这个问题有点着急,在线等强人回答~~谢谢!
clf
s=load('g:\dsp\wave.dat','-ascii');
mn=size(s);
m=mn(1,1);
hold on
subplot(221)
plot(s(1:m,1),s(1:m,2),'b')
title('通道1波形');
xlabel('t(s)');ylabel('Voltage(V)');
grid

fs=800;
N=4096;
Nshow=N/12;
figure(2)
y=fft(s(1:m,2),N);
mag=abs(y);
f=(0:length(y)-1)'*fs/length(y);
subplot(221)
plot(f(1:Nshow),mag(1:Nshow));
title('通道1波形的频谱');
xlabel('f(Hz)');ylabel('Amplitude');
grid

%窗函数设计
figure(3)
wp=0.35; %Normalized frequence fs/2
ws=0.40;
%Width of transition band
wdelta=ws-wp;
%Length of the filter
N=ceil(8*pi/wdelta);
if rem(N,2)==0
N=N+1;
end
%Length of the window
Nw=N;
%Cutoff Frequency of the filter
wc=(wp+ws)/2;
%Compute the impulse response of ideal filter
n=0:N-1;
alpha=(N-1)/2;
k=n-alpha+0.00001;
hd=sin(wc*k)./(pi*k);
%Compute time response of the Hamming Window
win=hanning(Nw);
%Compute acture impulse response of the filter
h=hd.*win';
b=h;

figure(4)
yc1=conv(s(1:m,2),b);
Istart=(length(b)-1)/2+1;
Iend=length(yc1)-(length(b)-1)/2;

subplot(221)
%plot(1:length(b)+m-1,yc1);
plot(1:m,yc1(Istart:Iend));
title('通道1滤波后的波形');
grid

N=2048;
Nshow=N/16;
figure(5)
y1=fft(yc1,N);
mag=abs(y1);
f=(0:length(y1)-1)'*fs/length(y1);
subplot(221);
plot(f(1:Nshow),mag(1:Nshow));
title('通道1滤波后波形的频谱');
xlabel('f(Hz)');ylabel('Amplitude');
grid
这是一个低通滤波的程序,想生成动态链接库在delphi里调用,请问如何实现啊?最好能提供直接的源代码,再次感谢!!