How can I add uncertainty to a data matrix?

3 visualizaciones (últimos 30 días)
Wiqas Ahmad
Wiqas Ahmad el 18 de Mayo de 2022
Comentada: Star Strider el 21 de Mayo de 2022
I obtained a signal data by running a simulation with input parameters. Some of these inputs are h,a,r,fov as shown in the following program. The output signals are beta_para and beta_per. The output signals are highly influenced by these four input parameters. What I want now is to add uncertainty to the inputs like fov±0.005 and obtained the signals with the input error. One way to do this is to repeat the simulation and input the parameters with uncertainties and obtained the output signals with error, however the process is very lengthy because my data is too big. I had come to know that we can deal it using repmat function in matlab as well without repeating the simulation. I don't know how can I use the repmat function to add uncertainties of the input parameters h,a,r,and fov to the signals beta_para and beta_per. Please if anybody can help me in this regard. My program is::
clear all,clc,close all
cloud = 'Homo';
T_para = zeros(5, 17, 20);
T_per = zeros(5, 17, 20);
h = 1000:1000:4000;
a = 0.01:0.01:0.05;
r = 4:1:20;
fov = [0.2, 0.5, 1, 2, 5, 10];
for i=1:length(h)
for j=1:length(fov)
dir_arhf = ['Tabledata_', cloud, '\', num2str(h(i)), 'm-', num2str(fov(j)), 'mrad'];
mkdir(dir_arhf);
for k=1:length(a)
for m=1:length(r)
load (['MCdatabase_', cloud, '/', num2str(a(k)), '-', num2str(r(m)), 'um/', num2str(h(i)), 'm-', num2str(fov(j)), 'mrad/I0.mat']);
load (['MCdatabase_', cloud, '/', num2str(a(k)), '-', num2str(r(m)), 'um/', num2str(h(i)), 'm-', num2str(fov(j)), 'mrad/Q0.mat']);
I_para = 1/2 * (I0 + Q0);
I_per = 1/2 * (I0 - Q0);
hh = genHeight(h(i)).^2;
beta_para = sum(I_para, 2) .* hh';
beta_per = sum(I_per, 2) .* hh';
T_para(a(k) * 100, r(m)-3, :) =beta_para';
T_per(a(k) * 100, r(m)-3, :) =beta_per';
save([dir_arhf, '\TABLE.mat'], 'T_per', 'T_para');
end
end
end
end

Respuesta aceptada

Star Strider
Star Strider el 18 de Mayo de 2022
The repmat funciton is likely not needed. Just do something like this:
h = h + randn(size(h));
and so for the rest.
See the randn documentation for details.
.
  12 comentarios
Wiqas Ahmad
Wiqas Ahmad el 21 de Mayo de 2022
I got it. Thank you
Star Strider
Star Strider el 21 de Mayo de 2022
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by