Shaded Standard Deviation Corridors
이전 댓글 표시
Hi,
Here is my code for my work and my data is already set up in columns on excel. The problem I'm getting is that my standard devation corridors are not filling up with the desired colors for both plots. Why might that be so? Attached is my code and the result of it. Thanks for your help in advance.
k
%Variance Corridor:
dataset=xlsread('Book1.xlsx', 'Sheet1')
tensile_stress = dataset(:,1); % your mean stress;
tensile_strain = dataset(:,2); % your mean strain;
std_dev_tensile_stress = dataset(:,3); % your std of stress;
surrogate_stress=dataset(:,4); % mean surrogate stress
surrogate_strain=dataset(:,5); % mean surrogate strain
std_dev_surrogate_stress=dataset(:,6); % surrogate std
x = tensile_strain;
y = tensile_stress;
sd = std_dev_tensile_stress;
x1=surrogate_strain
y1=surrogate_stress
sd1=std_dev_surrogate_stress
figure
patch([x; flipud(x)], [y-sd; flipud(y+sd)], [1,1,0]);
hold on
plot(x,y);
hold on
patch([x1; flipud(x1)], [y1-sd1; flipud(y1+sd1)], [0,1,1]);
hold on
plot(x1,y1);
hold off
채택된 답변
추가 답변 (2개)
It's because the last three values of x and y are NaN.
dataset=xlsread('Book1.xlsx', 'Sheet1');
tensile_stress = dataset(:,1); % your mean stress;
tensile_strain = dataset(:,2); % your mean strain;
std_dev_tensile_stress = dataset(:,3); % your std of stress;
surrogate_stress=dataset(:,4); % mean surrogate stress
surrogate_strain=dataset(:,5); % mean surrogate strain
std_dev_surrogate_stress=dataset(:,6); % surrogate std
x = tensile_strain;
y = tensile_stress;
sd = std_dev_tensile_stress;
x1 = surrogate_strain;
y1 = surrogate_stress;
sd1 = std_dev_surrogate_stress;
figure
hold on
patch([x(1:24); flipud(x(1:24))], [y(1:24)-sd(1:24); flipud(y(1:24)+sd(1:24))], [1,1,0]);
plot(x,y);
patch([x1; flipud(x1)], [y1-sd1; flipud(y1+sd1)], [0,1,1]);
plot(x1,y1);
hold off
Sulaymon Eshkabilov
2021년 9월 19일
편집: Sulaymon Eshkabilov
2021년 9월 19일
In your data, there are some missing data points (x, y, std) which must be removed and then everything works ok. Here is the corrected part of the code:
...
figure
A = [x; flipud(x)];
B = [y-sd; flipud(y+sd)];
IDX = isnan(A);
A(IDX)=[];
B(IDX)=[];
patch(A,B, [1,1,0]);
hold on
plot(x,y);
...
카테고리
도움말 센터 및 File Exchange에서 Stress and Strain에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

