Matlab中有子函数如何写主函数function TimeAnalysis()global SamplingFreq IF SatelliteNum FreqBand StartMs AnalysisMs ReadLengthMs AcquireBW StandardFreqfb=IF; fs=SamplingFreq; fstan=StandardFreq; f0=fb-fs; LL=20; switch FreqBandcase 4 load L
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/28 19:55:10
Matlab中有子函数如何写主函数function TimeAnalysis()global SamplingFreq IF SatelliteNum FreqBand StartMs AnalysisMs ReadLengthMs AcquireBW StandardFreqfb=IF; fs=SamplingFreq; fstan=StandardFreq; f0=fb-fs; LL=20; switch FreqBandcase 4 load L
Matlab中有子函数如何写主函数
function TimeAnalysis()
global SamplingFreq IF SatelliteNum FreqBand StartMs AnalysisMs ReadLengthMs AcquireBW StandardFreq
fb=IF;
fs=SamplingFreq;
fstan=StandardFreq;
f0=fb-fs;
LL=20;
switch FreqBand
case 4
load Local_E1I1.mat
load Local_E1I2.mat
load Local_E1Q.mat
load s_demoE1.mat
s1=real(s_demoE1);
s2=imag(s_demoE1);
Bandwide_filter=32.736e+6;
n1=fs/1000*4;
n2=fs/1000*2;
fc1=1*fstan;
fc2=2.5*fstan;
[MM NN]=max(abs(xcorr(Local_E1I1(1:n1),s1(1:n1))));
[MM1 NN1]=max(abs(xcorr(Local_E1I2(1:n1),s1(1:n1))));
if abs(MM)>=abs(MM1)
Local_E1I=Local_E1I1(1:n1);
else
Local_E1I=Local_E1I2(1:n1);
end
if max(xcorr(Local_E1I(1:n1),s1(1:n1)))-max(abs(xcorr(Local_E1I(1:n1),s1(1:n1))))~=0
Local_E1I=-Local_E1I;
end
Local_E1I=sqrt(2)/3*Local_E1I;
Local_E1I_filter=lp_filter(Bandwide_filter/2,Local_E1I(1:n1));
if max(xcorr(Local_E1Q(1:n2),s2(1:n2)))-max(abs(xcorr(Local_E1Q(1:n2),s2(1:n2))))~=0
Local_E1Q=-Local_E1Q;
end
Local_E1Q=2/3*Local_E1Q;
Local_E1Q_filter=lp_filter(Bandwide_filter/2,Local_E1Q(1:n2));
%%%%%%%%%时域波形及信噪比
figure
plot(s1(1:ceil(fs/fc1)*LL),'r')
hold on
plot(Local_E1I(1:ceil(fs/fc1)*LL),'b-.','LineWidth',1.5)
hold on
plot(Local_E1I_filter(1:ceil(fs/fc1)*LL),'k')
legend
title;
figure
plot(s2(1:ceil(fs/fc2)*LL),'r')
hold on
plot(Local_E1Q(1:ceil(fs/fc2)*LL),'b-.','LineWidth',1.5)
hold on
plot(Local_E1Q_filter(1:ceil(fs/fc2)*LL),'k')
legend
title;
snr1=SNR(Local_E1I(1:n1),s1(1:n1))
snr2=SNR(Local_E1I_filter(1:n1),s1(1:n1))
histgramFigure(s1(1:n1))
histgramFigure(s2(1:n2))
eyeFigure(s1(1:n1),fs,fc1)
eyeFigure(s2(1:n2),fs,fc2)
end
Matlab中有子函数如何写主函数function TimeAnalysis()global SamplingFreq IF SatelliteNum FreqBand StartMs AnalysisMs ReadLengthMs AcquireBW StandardFreqfb=IF; fs=SamplingFreq; fstan=StandardFreq; f0=fb-fs; LL=20; switch FreqBandcase 4 load L
function [a,b,c]=OUTPUT(e,f) %abc 为输出参数,ef为输入参数(根据需要,可有可无)
.
a=?; %输出参数一定要幅值!
b=?;
c=?;
end
在主程序里,调用格式为:[a,b,c]=OUTPUT(e,f)