time to sample convert
1 次查看(过去 30 天)
显示 更早的评论
Hi! how can i convert time vector of the following plot to number of sample?
clear all clc set(0,'defaultlinelinewidth',1) True_range=1000;%Range to target el=1.619*10^(-19);%electron charge pulse_width=10e-9; PRF=10;%pulse per second P_avg=0.4; %Average laser power E_t=P_avg/PRF;%energy per pulse in units of joule sigma_w=2e-9; %standard deviation second theta_t=.01; % divergence beam in radiance theta_r=pi;% Reflection angle prom target tau_atm=1;%atmospheric transmission loss tau_opt=1;%reciever optics transmission rho_t=.1;%target reflection reciever_focal=.1;% reciever focal length delta=1e-4;%physical size of the detectorin the ladar recieverin meters dA=(True_range*delta/reciever_focal)^2;%area of target illuminated by light ap_diameter=.01; Rmin=990; minT=Rmin*2/3e8; Rmax=1010; maxT=Rmax*2/3e8; deltat=sigma_w/10; %sample time to ensure good pulse shape sampling t=minT:deltat:maxT; %range of times over which the return signal is measured P_t=(E_t/(sqrt(2*pi)*sigma_w))*exp(-((t-True_range*2/3e8).^2)/(2*sigma_w^2)); I_target=4*tau_atm*P_t/(pi*(True_range^2)*(theta_t^2)); P_ref=I_target*dA*rho_t; %Reflected power I_reciever=tau_atm*P_ref/(theta_r*True_range^2); %intensity at the aperture P_rec= tau_opt*(ap_diameter^2)*pi*I_reciever/4; %recieved signal power after reciever optics % figure; % plot(t,P_rec) % xlabel('Time (sec)') % ylabel('Prec (watt)') % axis tight quantum_eff=.075; h=6.626e-34; v=3e8/1.55e-6; N=P_rec*deltat*quantum_eff/(h*v);%generated photoelectron figure; plot(t,N) xlabel('Time (sec)') ylabel('photon') title('noisless signal') axis tight
回答(1 个)
Kothuri
2024-8-23
To convert the time vector to samples in the last parameter "signal", you can
- Calculate the Number of Samples by determining the length of the time vector “t”.
- Create a Sample Index Vector that represents sample indices ranging from 1 to the number of samples.
- Plot the signal Using Sample index vector as the x-axis
% Calculate the number of samples
num_samples = length(t);
% Create a sample index vector
sample_indices = 1:num_samples;
% Plot the noisy signal using sample indices
figure;
plot(sample_indices, signal);
xlabel('Sample Number');
ylabel('Photon Count');
title('Noisy Signal');
axis tight;
By implementing these changes, you can display the signal data in terms of sample numbers.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!