plot confidence interval of a signal

조회 수: 84 (최근 30일)
Ase U
Ase U 2018년 8월 8일
댓글: RADWAN A F ZEYADI 2022년 1월 19일
Hi all,
i have a signal so it's just data, that i load on Matlab and I have to plot 95% confidence interval according to student t-distribution of my signal. Exactly like photo, that i added. When i am reading some solutions about that, i am confuse because i am not good about statistics. If you help me, at least how can i start to make something, i would be very appreciated that.
Thank you!
  댓글 수: 1
mpho bosupeng
mpho bosupeng 2022년 1월 9일
Hello
I suggest using the confplot. Access here confplot. Really easy
example:
x = 1:0.1:10;
y = sin(x);
e = std(y)*ones(size(x));
confplot(x,y,e)
As long as you have x and y you will be fine even if you import from excel

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

채택된 답변

Star Strider
Star Strider 2018년 8월 8일
In order to calculate the 95% confidence intervals of your signal, you first will need to calculate the mean and *|std| (standard deviation) of your experiments at each value of your independent variable. The standard way to do this is to calculate the standard error of the mean at each value of your independent variable, multiply it by the calculated 95% values of the t-distribution (here), then add and subtract those values from the mean. The plot is then straightforward. (The tinv function is in the Statistics and Machine Learning Toolbox.)
Example
x = 1:100; % Create Independent Variable
y = randn(50,100); % Create Dependent Variable ‘Experiments’ Data
N = size(y,1); % Number of ‘Experiments’ In Data Set
yMean = mean(y); % Mean Of All Experiments At Each Value Of ‘x’
ySEM = std(y)/sqrt(N); % Compute ‘Standard Error Of The Mean’ Of All Experiments At Each Value Of ‘x’
CI95 = tinv([0.025 0.975], N-1); % Calculate 95% Probability Intervals Of t-Distribution
yCI95 = bsxfun(@times, ySEM, CI95(:)); % Calculate 95% Confidence Intervals Of All Experiments At Each Value Of ‘x’
figure
plot(x, yMean) % Plot Mean Of All Experiments
hold on
plot(x, yCI95+yMean) % Plot 95% Confidence Intervals Of All Experiments
hold off
grid
This should get you started.
  댓글 수: 15
Star Strider
Star Strider 2021년 6월 25일
I suggest the cov function.
RADWAN A F ZEYADI
RADWAN A F ZEYADI 2022년 1월 19일
@Star Strider in my case also i want to compute CI for two vectors with dimension 51*1 you can see the picture that i have upload it

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by