filling an empty matrix using a for loop
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Bas Bloemendaal
le 20 Mai 2020
Réponse apportée : Srivardhan Gadila
le 27 Mai 2020
for j = abs(1:20:size(Bz,1))
Yi = Bz(j,minK(1,1));
lateral = find_coordinate(R2,Z2,Bz,Yi,0);
M_tot_spions_z = langevinfunc2(n,Kb,T,Brex(j,minK(1,1)), f, Vc, Ms,N);
U_det_r = abs((Yi.*M_tot_spions_z)/100e-9); % Counts 100[nV] Induced voltage [V]
figure;
plot(T_comb,U_det_r)
title([' Detected signal @ lateral distance =', num2str(abs(lateral)),' [m]'])
xlabel('Time [s]')
ylabel('Voltage [V]')
hold on
plot(T_comb, Noise)
end
Hello,
Is there a possibity to save all values for U_det_r so I can use these later on in a different plot?
0 commentaires
Réponse acceptée
Srivardhan Gadila
le 27 Mai 2020
You can define U_det_r as a cell array or normal array and store the values corresponding to each iteration as follows:
U_det_r = {};
for j = abs(1:20:size(Bz,1))
Yi = Bz(j,minK(1,1));
lateral = find_coordinate(R2,Z2,Bz,Yi,0);
M_tot_spions_z = langevinfunc2(n,Kb,T,Brex(j,minK(1,1)), f, Vc, Ms,N);
U_det_r{j} = abs((Yi.*M_tot_spions_z)/100e-9); % Counts 100[nV] Induced voltage [V]
figure;
plot(T_comb,U_det_r{j})
title([' Detected signal @ lateral distance =', num2str(abs(lateral)),' [m]'])
xlabel('Time [s]')
ylabel('Voltage [V]')
hold on
plot(T_comb, Noise)
end
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!