Why White Noise is not adding Uniformly to Signal?
Show older comments
I am adding noise,,generated through randn, to a signal However as seen in image the noise does not effect the low part of Input Signal. What can be the reason for it.
NOTE: Kindly ignore all parameters above in code.. you may focus from where i am adding noise (Mentioned in comments).
Its simply Multlipying an Input singnal added with noisr by transfer function and plotting the output
% clear all; format short e; close all;
fprintf('\n \n \n \n \n \n \n','%s');
% set(0,'DefaultAxesFontName','arial');
% set(0,'DefaultAxesFontSize',12);
global w f nfig k T;
nfig=0;
color1='-r';
color2='-k';
color10='-g';
color20='-b';
f=10e3:10e3:100e9;
w=2*pi*f;
k=13.8e-24;
T=300;
%%% Transistor Small-Signals Parameters %%% %%% %%% %%% %%% %%% %%% %%% %%%
Gmcsp=25e-3;
RFcsp=25e3;
ROcsp=1e6;
Cu=54.1283e-15;
Bcsp=13; % 0-31
CFcsp=10*Cu+Bcsp*Cu; %1.25 pF 1.248509 pF
%%% Transistor Small-Signals Parameters Shaper %%% %%% %%% %%% %%% %%% %%%
Gmsh=25e-3;
RFsh=430e3;
Rsh=12.5e3;
ROsh=1e6;
Cush=9.47242e-15;
Bsh=6; % 0-15
CFsh=64*Cush+Bsh*Cush; % 663e-15;
%%% Detector Parasitic Cap
CDE=60e-12;
%%% Transfer Function with Cf-CD %%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%%
syms gmcsp rocsp rfcsp cfcsp cde vocsp vcsp gmsh rosh rsh rfsh cfsh vosh vsh iin s
eq1= (vcsp-vocsp)*s*cfcsp + (vcsp-vocsp)/rfcsp + s*cde*vcsp -iin;
eq2= (vocsp-vcsp)*s*cfcsp + (vocsp-vcsp)/rfcsp + vocsp/rocsp + gmcsp*vcsp + (vocsp-vsh)/rsh;
eq3= (vsh-vosh)*s*cfsh + (vsh-vosh)/rfsh + (vsh-vocsp)/rsh;
eq4= (vosh-vsh)*s*cfsh + (vosh-vsh)/rfsh + vosh/rosh + gmsh*vsh;
tf=solve(eq1,eq2,eq3,eq4,vosh,vsh,vocsp,vcsp);
tf1=collect(tf.vosh,s);
fprintf('\n','%s');fprintf('vosh/iin(s) (NO CD-CGS1) \n','%s');fprintf('\n','%s');
pretty(tf1);
%%% Plot in s-Domain %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% vout/iin
nfig=nfig+1;
figure(nfig);
tfvosh=subs(tf.vosh,{gmcsp,rocsp,cfcsp,rfcsp,gmsh,rosh,rsh,rfsh,cfsh,cde,iin},{Gmcsp,ROcsp,CFcsp,RFcsp,Gmsh,ROsh,Rsh,RFsh,CFsh,CDE,1});
%[mag1,phase1]=plotting_from_system2(tfvosh,color1);
tfvocsp=subs(tf.vocsp,{gmcsp,rocsp,cfcsp,rfcsp,gmsh,rosh,rsh,rfsh,cfsh,cde,iin},{Gmcsp,ROcsp,CFcsp,RFcsp,Gmsh,ROsh,Rsh,RFsh,CFsh,CDE,1});
%[mag2,phase2]=plotting_from_system2(tfvocsp,color2);
ylabel('Magnitude - [dBOhm]');
title('vosh/qin');
legend('vosh','vocsp');
%%% Noise TF %%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%
syms gmcsp rocsp rfcsp cfcsp cde vocsp vcsp gmsh rosh rsh rfsh cfsh vosh vsh vncsp s
eq1= (vcsp+vncsp-vocsp)*s*cfcsp + (vcsp+vncsp-vocsp)/rfcsp + s*cde*(vcsp+vncsp);
eq2= (vocsp-vcsp-vncsp)*s*cfcsp + (vocsp-vcsp-vncsp)/rfcsp + vocsp/rocsp + gmcsp*vcsp + (vocsp-vsh)/rsh;
eq3= (vsh-vosh)*s*cfsh + (vsh-vosh)/rfsh + (vsh-vocsp)/rsh;
eq4= (vosh-vsh)*s*cfsh + (vosh-vsh)/rfsh + vosh/rosh + gmsh*vsh;
tfn=solve(eq1,eq2,eq3,eq4,vosh,vsh,vocsp,vcsp);
tfn1=collect(tfn.vosh,s);
fprintf('\n','%s');fprintf('vn1 TF \n','%s');fprintf('\n','%s');
pretty(tfn1);
%%% Noise Plot in s-Domain
%%% vout/vn
nfig=nfig+1;
figure(nfig);
tfnvosh=subs(tfn.vosh,{gmcsp,rocsp,cfcsp,rfcsp,gmsh,rosh,rsh,rfsh,cfsh,cde,vncsp},{Gmcsp,ROcsp,CFcsp,RFcsp,Gmsh,ROsh,Rsh,RFsh,CFsh,CDE,1});
%[magn1,phasen1]=plotting_from_system2(tfnvosh,color1);
tfnvocsp=subs(tfn.vocsp,{gmcsp,rocsp,cfcsp,rfcsp,gmsh,rosh,rsh,rfsh,cfsh,cde,vncsp},{Gmcsp,ROcsp,CFcsp,RFcsp,Gmsh,ROsh,Rsh,RFsh,CFsh,CDE,1});
%[magn2,phasen2]=plotting_from_system2(tfnvocsp,color2);
title('vosh/vnoise');
legend('vosh','vocsp');
%%% Equivalent Input Charge
Q=-5e-15;%:-1e-15:-10e-15;
QIN=Q;
QTIME=0.3e-9;
%%% Plot in Time-Domain %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% TIME AXIS
syms t;
wu=1/(RFsh*CFsh);
I=QIN/QTIME;
Tp=2/wu;
N=1000;
time=1:1:N;
time=Tp*time/N;
to1=1e-9;
to2=to1+1*QTIME; %to1+1*QTIME;
%%% Input Signal Laplace Transform
xins=(exp(-s*to1))*1/s-(exp(-s*to2))*(1/s);
xins=I*xins;
xint=ilaplace(xins);
xint=subs(xint,{t},{time});
%
noisevec =.055e-8*sqrt(0.707)*randn(size(time));
noisevecs=laplace(sym(noisevec));
% Output Signal
xinss=xins+noisevecs; %%%%%%Adding Noise to Signal
yss_sh=xinss*tfvosh; %%% Multipluing With Transfer function
%
%%% Output Signal
ys_sh=xins*tfvosh;
ys_csp=xins*tfvocsp;
%%% CFEQ=CF*(1+(1+RF/RL)*(CD/CF)/(Gm1*RL));
ysshtid=ilaplace(yss_sh);
yshtid=ilaplace(ys_sh);
ycsptid=ilaplace(ys_csp);
ysh=subs(yshtid,{t},{time});
yssh = zeros(size(time), 'sym');
for idx = 1 : numel(time);
yssh(idx) = subs(ysshtid(idx), t, time(idx));
end
ycsp=subs(ycsptid,{t},{time});
%%% Plot in Time-Domain %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nfig=nfig+1;
figure(nfig);
plot(time*1e9,-yssh*1e3,color2,'LineWidth',1);
hold on;
plot(time*1e9,-ysh*1e3,color1,'LineWidth',2);
hold on;
plot(time*1e9,ycsp*1e3,color2,'LineWidth',2);
xlabel('Time - [nsec]');ylabel('Voltage - [mV]');
title('vosh/Iin');
grid on;
legend('vosh','vocsp');

5 Comments
Adam Danz
on 4 Jun 2020
What's this?
time = time Tp * / N;
Syed Adeel
on 4 Jun 2020
Adam Danz
on 4 Jun 2020
FYI, I commented-out these 3 lines at the top of the code so users don't unintentionally make these changes to thier local systems by copying and executing all of your code.
% clear all; format short e; close all;
fprintf('\n \n \n \n \n \n \n','%s');
% set(0,'DefaultAxesFontName','arial');
% set(0,'DefaultAxesFontSize',12);
Syed Adeel
on 4 Jun 2020
Edited: Syed Adeel
on 4 Jun 2020
Answers (1)
Sulaymon Eshkabilov
on 4 Jun 2020
In your plot section, you are plotting three sets instead of four and thus, the noise added signal is not showing up.
See:
plot(time*1e9,-yssh*1e3,color2,'LineWidth',1); % noise added signal
hold on;
plot(time*1e9,-ysh*1e3,color1,'LineWidth',2); % clean signal
hold on;
plot(time*1e9,ycsp*1e3,color2,'LineWidth',2); % Clean signal
% Noise added signal: ys_csp is missing
1 Comment
Syed Adeel
on 4 Jun 2020
Categories
Find more on Get Started with MATLAB 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!