필터 지우기
필터 지우기

How can I add uncertainty to a data matrix?

조회 수: 2 (최근 30일)
Wiqas Ahmad
Wiqas Ahmad 2022년 5월 18일
댓글: Star Strider 2022년 5월 21일
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

채택된 답변

Star Strider
Star Strider 2022년 5월 18일
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
Wiqas Ahmad
Wiqas Ahmad 2022년 5월 21일
I got it. Thank you
Star Strider
Star Strider 2022년 5월 21일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel and Cloud에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by