How to resolve this error regarding pulsed waveform library?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am simulating radar resturns from sea surfaces. For this i am using chaotic signal but since chaotic code is not included in phased array toolbox so i use pulse waveform library to include in it but still it gives me error. Guide me how to resolve it. May be there is another implementation method. Please have a look. It should work correctly since it has worked for other applications.
Error using radarTransceiver
Expected Waveform to be one of these types:
phased.internal.AbstractPulseWaveform, phased.FMCWWaveform, phased.MFSKWaveform
Instead its type was pulseWaveformLibrary.
Error in radarTransceiver/set.Waveform (line 768)
validateattributes(val,{'phased.internal.AbstractPulseWaveform',...
Error in pleaseplease (line 60)
rdr.Waveform = pulseWaveformLibrary('SampleRate',fs, ...
rng(2021) % Initialize random number generator
% Radar parameters
freq = 2.4e9; % Carrier frequency (Hz)
prf = 50000; % PRF (Hz)
tpd = 2e-5; % Pulse width (s)
azBw = 4; % Azimuth beamwidth (deg)
depang = 30; % Depression angle (deg)
antGain = 45.7; % Antenna gain (dB)
fs = 100e6; % Sampling frequency (Hz)
bw = 10e5; % Waveform bandwidth (Hz)
bw2rangeres(bw)
% Sea surface
seaState = 4; % Sea state number
vw = 19; % Wind speed (knots)
L = 512; % Sea surface length (m)
resSurface = 2; % Resolution of sea surface (m)
% Calculate wavelength and get speed of light
[lambda,c] = freq2wavelen(freq);
% Setup sensor trajectory and simulation times
rdrht = 100; % Radar platform height (m)
rdrpos = [-L/2 0 rdrht]; % Radar position [x y z] (m)
numPulses = 2000; % Number of pulses
scenarioUpdateTime = 1/prf; % Scenario update time (sec)
scenarioUpdateRate = prf; % Scenario update rate (Hz)
simTime = scenarioUpdateTime.*(numPulses - 1); % Overall simulation time (sec)
% Create scenario
scene = radarScenario('UpdateRate',scenarioUpdateRate, ...
'IsEarthCentered',false,'StopTime',simTime);
% Define Elfouhaily sea spectrum
seaSpec = seaSpectrum('Resolution',resSurface) % See Elfouhaily reference
% Define reflectivity model
pol = 'V'; % Polarization
reflectModel = surfaceReflectivity('Sea','Model','GIT','SeaState',seaState,'Polarization',pol)
% Configure sea surface
knots2mps = 0.514444; % Knots to meters/sec
vw = vw*knots2mps; % Wind speed (m/s)
seaSurf = seaSurface(scene,'SpectralModel',seaSpec,'RadarReflectivity',reflectModel, ...
'WindSpeed',vw,'WindDirection',0,'Boundary',[-L/2 L/2; -L/2 L/2])
% Plot sea surface and radar
x = -L/2:resSurface:(L/2 - 1);
y = -L/2:resSurface:(L/2 - 1);
[xGrid,yGrid] = meshgrid(x,y);
z = height(seaSurf,[xGrid(:).'; yGrid(:).'],scene.SimulationTime);
% Significant wave height
actSigHgt = helperEstimateSignificantWaveHeight(x,y,z)
expectedSigHgt = [1.25 2.5]; % Sea state 4
actSigHgt >= expectedSigHgt(1) && actSigHgt <= expectedSigHgt(2)
% Create a radar platform using the trajectory information
rdrplat = platform(scene,'Position',rdrpos);
% Create a radar sensor looking to the East
rdr = radarTransceiver('MountingAngles',[0 depang 0],'NumRepetitions',1);
pw = 1e-06;
fcent = 5e+04;
rdr.Waveform = pulseWaveformLibrary('SampleRate',fs, ...
'WaveformSpecification',{{@ChaoticSignal,prf,pw,bw,fcent}});
rdr.Waveform = rdr.Waveform(1)
% Set receiver sample rate and noise figure
rdr.Receiver.SampleRate = fs;
rdr.Receiver.NoiseFigure = 10;
% Define transmit and receive antenna and corresponding parameters
ant = phased.SincAntennaElement('Beamwidth',azBw);
rdr.TransmitAntenna.OperatingFrequency = freq;
rdr.ReceiveAntenna.OperatingFrequency = freq;
rdr.Transmitter.Gain = antGain;
rdr.Receiver.Gain = antGain;
rdr.TransmitAntenna.Sensor = ant;
rdr.ReceiveAntenna.Sensor = ant;
% Add radar to radar platform
rdrplat.Sensors = rdr;
% Collect clutter returns with the clutterGenerator
clutterGenerator(scene,rdr);
% Run the scenario
numSamples = 1/prf*fs;
maxRange = 3e3;
Trng = (0:1/fs:(numSamples-1)/fs);
rngGrid = [0 time2range(Trng(2:end),c)];
[~,idxTruncate] = min(abs(rngGrid - maxRange));
iqsig = zeros(idxTruncate,numPulses);
ii = 1;
hRaw = helperPlotRawIQ(iqsig);
while advance(scene)
tmp = receive(scene); % nsamp x 1
iqsig(:,ii) = tmp{1}(1:idxTruncate);
if mod(ii,128) == 0
helperUpdatePlotRawIQ(hRaw,iqsig);
end
ii = ii + 1;
end
helperUpdatePlotRawIQ(hRaw,iqsig);
% Pulse compress
matchingCoeff = getMatchedFilter(rdr.Waveform);
rngresp = phased.RangeResponse('RangeMethod', 'Matched filter', ...
'PropagationSpeed',c,'SampleRate',fs);
[pcResp,rngGrid] = rngresp(iqsig,matchingCoeff);
% Plot
pcsigMagdB = mag2db(abs(pcResp));
[maxVal,maxIdx] = max(pcsigMagdB(:));
pcsigMagdB = pcsigMagdB - maxVal;
helperRangeTimePlot(rngGrid,prf,pcsigMagdB);
% Plot magnitude versus time
[idxRange,~] = ind2sub(size(pcsigMagdB),maxIdx);
helperMagTimePlot(pcsigMagdB(idxRange,:),numPulses,prf,rngGrid(idxRange));
% STFT
[S,F,T] = stft(pcResp(idxRange,:),scenarioUpdateRate);
helperSTFTPlot(S,F,T,lambda,rngGrid(idxRange));
% Look at a subset of data in range and convert to decibel scale
[~,idxMin] = min(abs(rngGrid - 180));
[~,idxMax] = min(abs(rngGrid - 210));
pcsigMagdB = mag2db(abs(pcResp(idxMin:idxMax,:)));
% Remove any inf values
pcsigMagdB(isinf(pcsigMagdB(:))) = [];
% Shift values to be positive
pcsigMagdB = pcsigMagdB(:) - min(pcsigMagdB(:)) + eps;
% Weibull parameters
% Note: These values can be obtained if you use fitdist(pcsigMagdB,'weibull')
scale = 32.5013;
shape = 6.3313;
% Plot histogram with theoretical PDF overlay
helperHistPlot(pcsigMagdB,scale,shape);
0 comentarios
Respuestas (1)
Sara James
el 6 de Ag. de 2024
The radarTransceiver feature does not support pulsedWaveformLibrary inputs. Documented accepted waveform types are as follows:
0 comentarios
Ver también
Categorías
Más información sobre Waveform-Level Simulations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!