How to make this loop fast.
Show older comments
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.
Answers (1)
madhan ravi
on 31 Oct 2018
1 vote
Remove all clear commands from the loop and see
1 Comment
Abhishek mani shukla
on 31 Oct 2018
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!