Popular posts from this blog
DSP
1.Bilinear clc; clear all; close all; b=[0.5266]; a=[1 1.03 0.5266]; fs=100; [bz,az]=bilinear(b,a,fs); 2.Butter worth Band stop clc; clear all; close all; fp1=200; fp2=400; fs1=100; fs2=500; Fs=2000; Wp1=2*fp1/Fs; Wp2=2*fp2/Fs; Ws1=2*fs1/Fs; Ws2=2*fs2/Fs; Rp=2; Rs=20; [N,Wc]=buttord([Wp1,Wp2],[Ws1,Ws2],Rp,Rs); [b,a]=butter(N,Wc,'stop'); w=0:0.1:pi; [h,omega]=freqz(b,a,w,'whole'); subplot(2,1,1); plot(omega/pi,20*log10(abs(h))) xlabel('omega/pi'); ylabel('Gain,db'); title(sprintf('N=%d Butterworth Lowpass Filter',N)); grid on; an=angle(h); subplot(2,1,2); plot(omega/pi,unwrap(an)); grid on; xlabel('normalized frequency'); ylabel('phase in radians'); 3.Butter worth Band pass clc; clear all; close all; fp1=200; fp2=400; fs1=100; fs2=500; Fs=2000; Wp1=2*fp1/Fs; Wp2=2*fp2/Fs; Ws1=2*fs1/Fs; Ws2=2*fs2/Fs; Rp=2; Rs=20; [N,Wc]=buttord([Wp1,Wp2],[Ws1,Ws2],Rp,Rs); [b,a]=butter(N,Wc); w=0:0.1:pi; [h,omega]=freqz(b,a,w,'whole'); subpl
ac lab
Constellation diagram clc;close all ; clear; m=16; k=log2(m); n=3000; sps=1; dataIn=randi([0 1],n,1); dataInMatrix=reshape(dataIn,length(dataIn)/k,k); dataSymbolsIn=bi2de(dataInMatrix); dataMod=qammod(dataSymbolsIn,m, 'bin' ); dataModG=qammod(dataSymbolsIn,m); % awgn EbNo=10; snr=EbNo+10*log10(k)-10*log10(sps); receivedSignal= awgn(dataMod,snr, 'measured' ); receivedSignalG= awgn(dataModG,snr, 'measured' ); sPlotFig=scatterplot(receivedSignal,1,0, 'g.' ); hold on ; scatterplot(dataMod,1,0,k*primesPlotFig); EYE DIAGRAM clc; clear; close all ; N=800; fs=5; randn( 'state' , 0); am=2*(rand(1,N)>0.5)-1; sincNum=sin(pi*(-fs:1/fs:fs)); sincDen=(pi*(-fs:1/fs:fs)); sincDenZero = find(abs(sincDen) < 10^-10); sinc0p= sincNum./sincDen; sinc0p(sincDenZero)=1; % raised cosine filter alpha = 0.5; cosNum = cos(alpha*pi*(-fs:1/fs:fs)); cosDen = (1-(2*alpha*(-fs: 1/fs:fs)).^2); cosDenZero=find(abs(cosDen)<10^-10); cos0p=cosNum./cosDen; cos0p(cosDenZero)=