Gaussian pulse normalized plotting
4 views (last 30 days)
Show older comments
Hi, I am trying to plot a fifth derivative gaussian pulse and then take its subsequent fft. But the problem that I am facing is that the plot of the curve is of extremely high magnitude and centralized across y-axis. But the desired plot need to be normalized along y-axis within [1,-1] and on positive x-axis. Currently the constant C is considered as 1. the code is as follows:
clc clear all t = linspace(-0.5,0.5,1e7).*1e-9; sig = 51*1e-12 ; %v = (-(t.^5)./(sqrt(2*pi)*sig^11) + (10*t.^3)./(sqrt(2*pi)*sig^9) - (15*t)/(sqrt(2*pi)*sig^7)) .* exp((-t.^2)./(2*sig^2)); v = zeros(1,length(t)) ; C = 1; size(t) for i = 1:length(t) v(i) = C*(-((t(i))^5)/(sqrt(2*pi)*sig^11) + (10*(t(i))^3)/(sqrt(2*pi)*sig^9) - (15*t(i))/(sqrt(2*pi)*sig^7)) * exp((-(t(i))^2)/(2*sig^2)); end
length(v) figure; plot(t,v); fs = 1e3; t = -0.5:1/fs:0.5; L = length(t) ; n = 2^nextpow2(L); amp = fft(v,n) ; amp1 = fftshift(amp) ; f = fs*(0:(n/2))/n; %f=fs*(-n/2:n/2-1)/n ; p = abs(v/n) ;
figure; plot(f,20*log10(p(1:n/2+1)))
0 Comments
Answers (0)
See Also
Categories
Find more on Spectral Measurements 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!