Info

This question is closed. Reopen it to edit or answer.

How to find the RMSE? Reposted @torsten

5 views (last 30 days)
Sadiq Akbar
Sadiq Akbar on 21 Jan 2025
Closed: Rik on 21 Jan 2025
@Torsten
Even I responded there several times but then I became busy and when I got free to respond there, my response was not recorded. I tried sevral times but in vain. That's why I am re-posting here.
I used the "rmse code" with my previous code (just added awgn() to add noise ) but it gives me error:
clear;clc
ula = phased.ULA('NumElements',10,'ElementSpacing',0.5);
angs = [40 -20 20; 0 0 0];% angs=[azimuth; elevation]; My desired angles are 40, -20 and 20.
NumSignals = size(angs,2);
c = physconst('LightSpeed');
fc = 300e6; % Operating frequency
lambda = c/fc;
pos = getElementPosition(ula)/lambda;
Nsamp = 10;%1000;
nPower = 0.01;
rs = rng(2007);
signal = sensorsig(pos,Nsamp,angs,nPower);
signal = awgn(signal,-15);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MUSIC Algorithm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
musicspatialspect = phased.MUSICEstimator('SensorArray',ula,...
'OperatingFrequency',fc,'ScanAngles',-90:90,...
'DOAOutputPort',true,'NumSignalsSource','Property','NumSignals',NumSignals);
[~,ang] = musicspatialspect(signal)
ymusic = musicspatialspect(signal);
helperPlotDOASpectra(musicspatialspect.ScanAngles,ymusic)% Changed by Me
function helperPlotDOASpectra(x2,y2)% Changed by Me
% Plot spectra in dB normalized to 0 dB at the peak
y2_dB = 20*log10(y2) - max(20*log10(y2));
plot(x2,y2_dB)
xlabel('Broadside Angle (degrees)');
ylabel('Power (dB)');
title('DOA Spatial Spectra')
end
%%%%%%% RMSE
num_runs = 100;
rmse_values = zeros(1, num_runs);
for idx = 1:num_runs
error = angs - ang;
rmse = sqrt(mean(error.^2));
rmse_values(idx) = rmse;
end
figure;
plot(1:num_runs, rmse_values, '-o');
xlabel('Run Number');
ylabel('RMSE');
title('RMSE vs Number of Runs');
grid on;
  1 Comment
Rik
Rik on 21 Jan 2025

If posting a reply results in a technical error, you should contact support.

Answers (0)

This question is closed.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!