CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@Vila • 07 Feb, 2009 • 1 like
Hiiii everybody,
Anyone have matlab codes for noise or jammers? I tried googling but can't find. Please help me get one. Thank you...
Anyone have matlab codes for noise or jammers? I tried googling but can't find. Please help me get one. Thank you...
@silverscorpion • 07 Feb, 2009
what exactly do you want? code for noise generation or noise removal..
As to jammers, it's very easy. if you know the frequency you want to jam, you can generate some random signal of that frequency and greater amplitude. That's it.
If you dont know the frequency, then it becomes somewhat more difficult. Then you have to use hardware also. It cant be done only with matlab code. ie, use your receiver and receive the signal. know the frequency components in it and then generate that frequency. Clear?
As to jammers, it's very easy. if you know the frequency you want to jam, you can generate some random signal of that frequency and greater amplitude. That's it.
If you dont know the frequency, then it becomes somewhat more difficult. Then you have to use hardware also. It cant be done only with matlab code. ie, use your receiver and receive the signal. know the frequency components in it and then generate that frequency. Clear?
@Vila • 08 Feb, 2009
Hii,
I need matlab codes for noise generation and also codes for broadband noise jammer.
Thank you...
I need matlab codes for noise generation and also codes for broadband noise jammer.
Thank you...
@silverscorpion • 08 Feb, 2009
hey you!
I just answered your question and you are reposting the question again. I'll again tell you, we dont give you the code here. You do the code, if there are any problems, we'll be happy to help.
I just answered your question and you are reposting the question again. I'll again tell you, we dont give you the code here. You do the code, if there are any problems, we'll be happy to help.
@durga ch • 08 Feb, 2009
gaussian?
what type of noise are you refering to?VilaHii,
I need matlab codes for noise generation and also codes for broadband noise jammer.
Thank you...
gaussian?
@Vila • 09 Feb, 2009
Hiii,
Gaussian, AWGN or Broadband noise, either one can do..
Thank you.
Gaussian, AWGN or Broadband noise, either one can do..
Thank you.
@Vila • 09 Feb, 2009
Hiii,
Mmm well i have some codes here, its shows errors. to whom i have to show them to get rectified? Do i just post the codes here?
Thank you.
Mmm well i have some codes here, its shows errors. to whom i have to show them to get rectified? Do i just post the codes here?
Thank you.
@silverscorpion • 09 Feb, 2009
just post that section of the code which has errors in it. Or if it's ok for you, posting the full code is no harm, either.. Post it in this thread itself.
@durga ch • 09 Feb, 2009
may be you can search the 'help ' section in your matlab for 'awgn' command
for more infomration you can as well refer to the MATLAB help link
Communications Toolbox Documentation
If your matlab has communications tool box, you have function 'awgn' which generated white gaussian noise and adds it to your signal depending on the impedance and nosie DBVilaHiii,
Mmm well i have some codes here, its shows errors. to whom i have to show them to get rectified? Do i just post the codes here?
Thank you.
may be you can search the 'help ' section in your matlab for 'awgn' command
for more infomration you can as well refer to the MATLAB help link
Communications Toolbox Documentation
@Vila • 09 Feb, 2009
This program should show the effect of Gaussian filter.
%%%%%%%%%%%%% The main.m file %%%%%%%%%%%%%%%
clear;
% Parameters of the Gaussian filter:
n1=10;sigma1=3;n2=10;sigma2=3;theta1=0;
% The amplitude of the noise:
noise=0.1;
[w,map]=gifread('lena.gif');
x=ind2gray(w,map);
filter1=d2gauss(n1,sigma1,n2,sigma2,theta);
x_rand=noise*randn(size(x));
y=x+x_rand;
f1=conv2(x,filter1,'same');
rf1=conv2(y,filter1,'same');
figure(1);
subplot(2,2,1);imagesc(x);
subplot(2,2,2);imagesc(y);
subplot(2,2,3);imagesc(f1);
subplot(2,2,4);imagesc(rf1);
colormap(gray);
%%%%%%%%%%%%%% End of the main.m file %%%%%%%%%%%%%%%
When i tried to run them, it shows this error message:
Error in ==> gaussian at 7
[w,map]=gifread('lena.gif');
Thanks for helping...
%%%%%%%%%%%%% The main.m file %%%%%%%%%%%%%%%
clear;
% Parameters of the Gaussian filter:
n1=10;sigma1=3;n2=10;sigma2=3;theta1=0;
% The amplitude of the noise:
noise=0.1;
[w,map]=gifread('lena.gif');
x=ind2gray(w,map);
filter1=d2gauss(n1,sigma1,n2,sigma2,theta);
x_rand=noise*randn(size(x));
y=x+x_rand;
f1=conv2(x,filter1,'same');
rf1=conv2(y,filter1,'same');
figure(1);
subplot(2,2,1);imagesc(x);
subplot(2,2,2);imagesc(y);
subplot(2,2,3);imagesc(f1);
subplot(2,2,4);imagesc(rf1);
colormap(gray);
%%%%%%%%%%%%%% End of the main.m file %%%%%%%%%%%%%%%
When i tried to run them, it shows this error message:
Error in ==> gaussian at 7
[w,map]=gifread('lena.gif');
Thanks for helping...
@Vila • 09 Feb, 2009
These are another set of codes in which it should display Rayleigh function graph:
%Initialization D=1 (D = interleaving depth)
clear;
Ts=1/1e3; % tx rate = 10k bps
NA=10000;
A=floor(rand(1,NA)+0.5);
%A=randint(1,NA);
input=A;
G=[1 0 0; 1 0 1; 1 1 1];
k=1;
N=length(channel_output);
SNRdB= -10:5:20;
SNR=10.^(SNRdB/10);
Counter=zeros(1,length(SNRdB));
loop=0;
%***************************************************************
% AWGN + fading *
%***************************************************************
Fd=66; % Actual fading rate
fm=round(Fd*NA*Ts);
%Generate two inputs of 1 x N matrix
xin=randn(1,(NA+2)*3);
yin=randn(1,(NA+2)*3);
%Loop for all values of frequencies and truncate at just before f=fm
for f=1😔fm-1)
filter(f)=1.5/(pi*fm*sqrt(1-(f/fm)^2));
end
for f=(fm-1)😔NA+2)*3
filter(f)=0;
end
%Inputs of the filter is multiplied with the filter transfer function
xout=xin.*filter;
yout=yin.*filter;
%Perform inverse Fourier Transform on both output
xifft=real(ifft(xout));
yifft=real(ifft(yout));
% normaliation so that E{R^2}= 1 / in Watt = 0 dB
std_x=std(xifft);
std_y=std(yifft);
xifft=xifft/std_x/sqrt(2);
yifft=yifft/std_y/sqrt(2);
%Sum the square the of the IFFT and take the square root of it
rx=sqrt(xifft.^2+yifft.^2);
%****************************************************************
%Calculate for all value of SNRdB in AWGN + fading
%****************************************************************
loop=0;
for b=sqrt(SNR) %b is the signal level
loop=loop+1;
dfad=0;
for n=1😔NA+2)*3 %n = no of bits
x=randn;
t=channel_output(n);
if t>=0.5
a=b*rx(n);
r=a+x;
if r<0
dfad=dfad+1; % error has occured, increase counter
Df(n)=0;
else
Df(n)=1;
end
else
a=(-b)*rx(n);
r=a+x;
if r>0
dfad=dfad+1;
Df(n)=1;
else
Df(n)=0;
end
end
Counterf(loop)=dfad; % w/o decode
end
output=viterbi(G,k,Df); % E is output of decoder
zf=0;
v=1;
for v=v:1:length(A);
if xor(input(1,v),output(1,v))==1
zf=zf+1;
end
end
Counter_wcf(loop)=zf;
end% loop for signal (b) in AWGN + fading
%plot simulation in AWGN + fading without coding
Pef=Counterf/N;
%semilogy(SNRdB,Pef,'b');
%hold on;
%plot simulation in AWGN + fading with coding
Pe1f=Counter_wcf/NA;
save D1_66SNRdBPe1fPef
%semilogy(SNRdB,Pe1f,'b'); %D=1 no interleaving
%hold on;
but when i tried running them, it shows this error message:
Error in ==> Rayleigh at 12
N=length(channel_output);
Please help me..thank you
%Initialization D=1 (D = interleaving depth)
clear;
Ts=1/1e3; % tx rate = 10k bps
NA=10000;
A=floor(rand(1,NA)+0.5);
%A=randint(1,NA);
input=A;
G=[1 0 0; 1 0 1; 1 1 1];
k=1;
N=length(channel_output);
SNRdB= -10:5:20;
SNR=10.^(SNRdB/10);
Counter=zeros(1,length(SNRdB));
loop=0;
%***************************************************************
% AWGN + fading *
%***************************************************************
Fd=66; % Actual fading rate
fm=round(Fd*NA*Ts);
%Generate two inputs of 1 x N matrix
xin=randn(1,(NA+2)*3);
yin=randn(1,(NA+2)*3);
%Loop for all values of frequencies and truncate at just before f=fm
for f=1😔fm-1)
filter(f)=1.5/(pi*fm*sqrt(1-(f/fm)^2));
end
for f=(fm-1)😔NA+2)*3
filter(f)=0;
end
%Inputs of the filter is multiplied with the filter transfer function
xout=xin.*filter;
yout=yin.*filter;
%Perform inverse Fourier Transform on both output
xifft=real(ifft(xout));
yifft=real(ifft(yout));
% normaliation so that E{R^2}= 1 / in Watt = 0 dB
std_x=std(xifft);
std_y=std(yifft);
xifft=xifft/std_x/sqrt(2);
yifft=yifft/std_y/sqrt(2);
%Sum the square the of the IFFT and take the square root of it
rx=sqrt(xifft.^2+yifft.^2);
%****************************************************************
%Calculate for all value of SNRdB in AWGN + fading
%****************************************************************
loop=0;
for b=sqrt(SNR) %b is the signal level
loop=loop+1;
dfad=0;
for n=1😔NA+2)*3 %n = no of bits
x=randn;
t=channel_output(n);
if t>=0.5
a=b*rx(n);
r=a+x;
if r<0
dfad=dfad+1; % error has occured, increase counter
Df(n)=0;
else
Df(n)=1;
end
else
a=(-b)*rx(n);
r=a+x;
if r>0
dfad=dfad+1;
Df(n)=1;
else
Df(n)=0;
end
end
Counterf(loop)=dfad; % w/o decode
end
output=viterbi(G,k,Df); % E is output of decoder
zf=0;
v=1;
for v=v:1:length(A);
if xor(input(1,v),output(1,v))==1
zf=zf+1;
end
end
Counter_wcf(loop)=zf;
end% loop for signal (b) in AWGN + fading
%plot simulation in AWGN + fading without coding
Pef=Counterf/N;
%semilogy(SNRdB,Pef,'b');
%hold on;
%plot simulation in AWGN + fading with coding
Pe1f=Counter_wcf/NA;
save D1_66SNRdBPe1fPef
%semilogy(SNRdB,Pe1f,'b'); %D=1 no interleaving
%hold on;
but when i tried running them, it shows this error message:
Error in ==> Rayleigh at 12
N=length(channel_output);
Please help me..thank you
@silverscorpion • 09 Feb, 2009
In the first piece of code, try using imread() instead of gifread(). I'm not sure if a function gifread() to specifically read gif files exist.
In the second piece of code, you dont seem to have defined what is 'channel_output'. you have used channel_output as a function in the later part of the code, and in the top part, you have tried to find the length of a function. That might be the problem.
In the second piece of code, you dont seem to have defined what is 'channel_output'. you have used channel_output as a function in the later part of the code, and in the top part, you have tried to find the length of a function. That might be the problem.
@durga ch • 09 Feb, 2009
I dotn see channel_output being defined. Did yu put up the whole code mate?
@Vila • 10 Feb, 2009
It gives the same error even if i use imread() instead of gifread()
Yes whole code mate, how do i define the channel_output then?
Yes whole code mate, how do i define the channel_output then?
@durga ch • 10 Feb, 2009
Hi
clear;
Ts=1/1e3; % tx rate = 10k bps
NA=10000;
A=floor(rand(1,NA)+0.5);
%A=randint(1,NA);
input=A;
G=[1 0 0; 1 0 1; 1 1 1];
k=1;
N=length(channel_output);
SNRdB= -10:5:20;
SNR=10.^(SNRdB/10);
Counter=zeros(1,length(SNRdB));
loop=0;
if ts is your transmitted signal then your channle output should be a convolution of you input signal and noise.
ie your channel output should be on lines of
output = H * input;
where H is is your channel matirx and inout in Tx
clear;
Ts=1/1e3; % tx rate = 10k bps
NA=10000;
A=floor(rand(1,NA)+0.5);
%A=randint(1,NA);
input=A;
G=[1 0 0; 1 0 1; 1 1 1];
k=1;
N=length(channel_output);
SNRdB= -10:5:20;
SNR=10.^(SNRdB/10);
Counter=zeros(1,length(SNRdB));
loop=0;
if ts is your transmitted signal then your channle output should be a convolution of you input signal and noise.
ie your channel output should be on lines of
output = H * input;
where H is is your channel matirx and inout in Tx
@Vila • 11 Feb, 2009
Hiii thanks a lot,
Now i have a set of coding over here but i dont know how to determine which one is the information signal and which one is the carrier signal, wheter xin, yin, xout or yout..and what is NA?
%Initialization D=1 (D = interleaving depth)
clear;
Ts=1/1e3; % tx rate = 10k bps
NA=1000;
A=floor(rand(1,NA)+0.5);
%A=randint(1,NA);
input=A;
G=[1 0 1 1 0 1 1; 1 1 0 0 1 0 1; 1 1 1 1 1 0 1];
%G=[1 0 0; 1 0 1; 1 1 1];
k=1;
channel_output=cnv_encd(G,k,A);
N=length(channel_output);
SNRdB= -10:5:20;
SNR=10.^(SNRdB/10);
Counter=zeros(1,length(SNRdB));
loop=0;
L_one=length(G)-1;
no_rows=size(G,1);
encoder_output_bits=(NA+L_one)*no_rows;
%***************************************************************
% AWGN + fading *
%***************************************************************
Fd=2000; % Actual fading rate
fm=round(Fd*NA*Ts);
%Generate two inputs of 1 x N matrix
xin=randn(1,encoder_output_bits);
yin=randn(1,encoder_output_bits);
%Loop for all values of frequencies and truncate at just before f=fm
for f=1😔fm-1)
filter(f)=1.5/(pi*fm*sqrt(1-(f/fm)^2));
end
for f=(fm-1):encoder_output_bits
filter(f)=0;
end
%Inputs of the filter is multiplied with the filter transfer function
xout=xin.*filter;
yout=yin.*filter;
%Perform inverse Fourier Transform on both output
xifft=real(ifft(xout));
yifft=real(ifft(yout));
% normaliation so that E{R^2}= 1 / in Watt = 0 dB
std_x=std(xifft);
std_y=std(yifft);
xifft=xifft/std_x/sqrt(2);
yifft=yifft/std_y/sqrt(2);
%Sum the square the of the IFFT and take the square root of it
rx=sqrt(xifft.^2+yifft.^2);
plot(xout);
plot(yout);
Thank you mate...
Now i have a set of coding over here but i dont know how to determine which one is the information signal and which one is the carrier signal, wheter xin, yin, xout or yout..and what is NA?
%Initialization D=1 (D = interleaving depth)
clear;
Ts=1/1e3; % tx rate = 10k bps
NA=1000;
A=floor(rand(1,NA)+0.5);
%A=randint(1,NA);
input=A;
G=[1 0 1 1 0 1 1; 1 1 0 0 1 0 1; 1 1 1 1 1 0 1];
%G=[1 0 0; 1 0 1; 1 1 1];
k=1;
channel_output=cnv_encd(G,k,A);
N=length(channel_output);
SNRdB= -10:5:20;
SNR=10.^(SNRdB/10);
Counter=zeros(1,length(SNRdB));
loop=0;
L_one=length(G)-1;
no_rows=size(G,1);
encoder_output_bits=(NA+L_one)*no_rows;
%***************************************************************
% AWGN + fading *
%***************************************************************
Fd=2000; % Actual fading rate
fm=round(Fd*NA*Ts);
%Generate two inputs of 1 x N matrix
xin=randn(1,encoder_output_bits);
yin=randn(1,encoder_output_bits);
%Loop for all values of frequencies and truncate at just before f=fm
for f=1😔fm-1)
filter(f)=1.5/(pi*fm*sqrt(1-(f/fm)^2));
end
for f=(fm-1):encoder_output_bits
filter(f)=0;
end
%Inputs of the filter is multiplied with the filter transfer function
xout=xin.*filter;
yout=yin.*filter;
%Perform inverse Fourier Transform on both output
xifft=real(ifft(xout));
yifft=real(ifft(yout));
% normaliation so that E{R^2}= 1 / in Watt = 0 dB
std_x=std(xifft);
std_y=std(yifft);
xifft=xifft/std_x/sqrt(2);
yifft=yifft/std_y/sqrt(2);
%Sum the square the of the IFFT and take the square root of it
rx=sqrt(xifft.^2+yifft.^2);
plot(xout);
plot(yout);
Thank you mate...
@durga ch • 11 Feb, 2009
anyways
A is your input signal. it s a randaom signal generated. NA can be any number and you rand 1,1000 .
and your G is the convoluional encoder in polynomial representation
hmm, tell me one thing has this code been picked off from the net?VilaHiii thanks a lot,
Ts=1/1e3; % tx rate = 10k bps
NA=1000;
A=floor(rand(1,NA)+0.5);
%A=randint(1,NA);
input=A;
G=[1 0 1 1 0 1 1; 1 1 0 0 1 0 1; 1 1 1 1 1 0 1];
k=1;
channel_output=cnv_encd(G,k,A);
anyways
A is your input signal. it s a randaom signal generated. NA can be any number and you rand 1,1000 .
and your G is the convoluional encoder in polynomial representation
@Vila • 12 Feb, 2009
Hiii...yes its from the net...if A is the input signal then how about xin and yin?
@stylishdudevicky • 22 Mar, 2010
Hi,
I know few people who can write any Matlab or programming codes as a pay service. contact them at coders.programmers@gmail.com
Hope this helps.
I know few people who can write any Matlab or programming codes as a pay service. contact them at coders.programmers@gmail.com
Hope this helps.
@robben71 • 05 Apr, 2011
Hi, does anyone have code for gray world and white point (image processing)?
@KrishTCE • 18 Feb, 2015
Hi...... i need the verilog code for generating jamming signal......... can anyone tell me the logic for generating???
@danish salim soonka • 20 Aug, 2016
i need to implement a jammer model can anyone help?
4.4k views
Related Posts
@Chaitanya Kukde · Sep 2, 2014
The technoholics in India are often seen fretting about how cool technologies are always arriving late in India and how many of them are forced to buy their favorite products...
6k views
@Ankita Katdare · Jul 25, 2013
Skoda India, the Czech automaker is all set to announce the all new Skoda Octavia vRS, the fastest Octavia ever to come out of the company's production house. Featuring two...
4.9k views
@Kaustubh Katdare · May 8, 2015
Chandrayaan-2, India's ambitious second mission to the moon has been scheduled to take off sometime in 2017, the Indian Parliament was informed yesterday. Jitendra Singh, the minister of state in...
3.5k views
@Manish Goyal · Dec 13, 2010
Veena who is the sister-in-law of Ashok, is the daughter-in-law of Kalyani. Dheeraj is the father of Sudeep who is the only brother of Ashok. How Kalyani is related to...
4k views
@ravitejabhukya · Feb 6, 2012
Can any one suggest me a good name for our college fest (ofcourse it is for mechanical dept.) ?
very urgent please 😔
ps: the name should be related to...
11.7k views