
Chosing the correct x scale after convolution
6 ビュー (過去 30 日間)
古いコメントを表示
Hi there,
I am trying to solve a, in principle, very simple statistical problem with the conv function in Matlab. Unfortunately, I do not really understand the outcome of the calculations.The model that is used describes the probability of observing a single event with energy E that is
u=1/(a*T)*exp(-E/(a*T)).
The parameter a is fixed and can for demonstration purposes set to 1. E is the variable and T is the temperature. However, not the probability of a single event but the combined probability of several are of interest. For example the probability for two consequtive events is just the convolution of the probabilities of the two single events. The various events can have different temperatures lets say T1,T2,... and hence I will label the functions u1,u2,.. (but they will all have the same energy scale E). In Matlab I simply wrote the code
E=0:0.01:10; % set energy scale
T=[520 480 441 402 364 325 287 249 211 175 138]; % set temperatures
for i=1:size(T,2)
u(i,:)=1./T(i).*exp(-E./T(i)); % calculate all possible distribution functions
end
w(1,:)=conv(u(1,:),u(2,:),'full'); % First combined probability
The generalization to all other terms should be easy. However, if I use the 'full' option I get the expected result but with 2*length(E)-1 datapoints in w. This is clear insofar that this is how the convolution works in Matlab. But how can I link the combined probability to the SAME energy scale I used to define the seperate distribution functions?
More confusing is the result when I use the 'same' option of conv. Then the number of data points of w is identical to u1 and u2 but the result looks completly different. Usually I did convolutions analytically and not numerically and maybe I do not get the difference here. Therefore, any advice concerning this problem is highly appreciated.
Best
Sven
0 件のコメント
回答 (3 件)
Image Analyst
2014 年 12 月 4 日
Sven, they're the same. The "same" is just cropped from the interior of the "full" like you expect. Look

E=0:0.01:10; % set energy scale
T=[520 480 441 402 364 325 287 249 211 175 138]; % set temperatures
for i=1:size(T,2)
u(i,:)=1./T(i).*exp(-E./T(i)); % calculate all possible distribution functions
end
wFull = conv(u(1,:),u(2,:),'full'); % First combined probability
wSame = conv(u(1,:),u(2,:),'same'); % First combined probability
plot(wFull, 'b-', 'LineWidth', 2);
hold on;
plot(wSame, 'r-', 'LineWidth', 2);
grid on;
legend('Full', 'Same');
0 件のコメント
Achim Göritz
2014 年 12 月 15 日
Hi everyone,
I give it a last chance. Does someone know what causes these dramatic changes between the 'same' and the 'full' method? It seems very strange to me that the outcome of the function depends on the choice of the numbers.
Any hints or tips are highly appriciated.
Best
Sven
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Random Number Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
