Create a matrix for data with various iterations

1 Ansicht (letzte 30 Tage)
Miguel Albuquerque
Miguel Albuquerque am 17 Mai 2022
Beantwortet: Rangesh am 26 Sep. 2023
hey to all, thanks for reading this in advance. I want to calculate Surveillance_SignalFD and Reference_SignalFD as a matrix, where each rows corresponds to a different y_transmitter. The code I have, for each y_transmitter it calculates this variables, but on the next iteration it replaces the values of the previous one. I want to save all the values of each iteration in a matrix.
Thanks guys
for i=1:numel(waypoints)
Y_transmitter = waypoints(i);
for xx=1:200
for yy=1:200
if AoI(xx,yy) ~= 0 % Target detection
X_target= xx;
Y_target= yy;
Surveillance_SignalFD=(1/(R1+R2))*X_QPSK.*exp(-1*j*k0*(R1+R2)); % Surveillance Signal frequency domain
Reference_SignalFD=(1/Rd)*X_QPSK.*exp(-1*j*k0*Rd); % Reference Signal frequency domain

Antworten (1)

Rangesh
Rangesh am 26 Sep. 2023
Hello Miguel,
I understand that you want to save the values of every iteration in a matrix. To achieve it, you can follow the steps below:
  1. Create a zero matrix with the preallocated size - numel(waypoints)x200x200 as follows:
Surveillance_SignalFD=zeros(numel(waypoints),200,200)
Reference_SignalFD=zeros(numel(waypoints),200,200)
2.Store the values by assigning the elements of the matrix as follows:
Surveillance_SignalFD(i,xx,yy)=(1/(R1+R2))*X_QPSK.*exp(-1*j*k0*(R1+R2)); % Surveillance Signal frequency domain
Reference_SignalFD(I,xx,yy)=(1/Rd)*X_QPSK.*exp(-1*j*k0*Rd); % Reference Signal frequency domain
You can refer to the following MATLAB Documentations of numel”, “matrices and arrays” and “zeros” for more information:
I hope this resolves your query.
Thanks,
Rangesh.

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by