How to make this loop fast.

I want to optimised the below given code,
for I=1:1*10^5
y1=Mod_sig*h(1,I)*Theta(1,I);
rx=y1+1*Noise(no_of_points, Nsp,Gain_edfa,h_p,Nu,B);
clear y1
rx_fft=fftshift(fft(rx));
clear rx
obpf_opfd=OBPF.*rx_fft;
clear rx_fft
Obpf_optd=ifft(ifftshift(obpf_opfd));
clear obpf_opfd
De_mod=Delay_demodulation(Obpf_optd,samples_per_bit);
clear Obpf_optd
Elpf_op= lowpass_bessel_filter_output(order,cutoff_frequency,De_mod,Fs);
clear De_mod
Samp_sel=Elpf_op(:,4:samples_per_bit:end);
clear Elpf_op
Th_op=Samp_sel>0;
error=sum(sum(data1~=Th_op));
Err=[Err error];
end
its taking a lot of time.

回答 (1 件)

madhan ravi
madhan ravi 2018 年 10 月 31 日

1 投票

Remove all clear commands from the loop and see

1 件のコメント

Abhishek mani shukla
Abhishek mani shukla 2018 年 10 月 31 日
thanks for your suggestion but its not working.

サインインしてコメントする。

カテゴリ

製品

リリース

R2017a

質問済み:

2018 年 10 月 31 日

コメント済み:

2018 年 10 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by