MATLAB Answers

How to add Error Bars in fit curve line graph?

조회 수: 1(최근 30일)
Hassan Ashraf
Hassan Ashraf 2019년 12월 5일
Hey!
I want to put Error Bars in my line graph, I am using " fit " function on my data to smooth curves. And it is working fine. But I dont know how to put error bars on line graph while using ' fit " function. Below is the attached file of the dataset I am using and code.
clear all
clc
load('MCA_Disjoint_SegmentWise.mat')
Data1LDA = MCA_Disjoint(: , 1);
Data2LDA = MCA_Disjoint(: , 3);
Data3LDA = MCA_Disjoint(: , 5);
WindowSizes = 50:25:450;
WindowSizes = WindowSizes';
f1=fit(WindowSizes,Data1LDA,'cubicinterp');
f2=fit(WindowSizes,Data2LDA,'cubicinterp');
f3=fit(WindowSizes,Data3LDA,'cubicinterp');
figure
hold on
p(1,:) = plot(f1,WindowSizes,Data1LDA);
p(2,:) = plot(f2,WindowSizes,Data2LDA);
p(3,:) = plot(f3,WindowSizes,Data3LDA);
set(p(1,:),'LineWidth',2,...
'Color','black',...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[.49 1 .63],...
'MarkerSize',20)
set(p(2,:),'LineWidth',2,...
'Color','red',...
'MarkerEdgeColor','r',...
'MarkerFaceColor',[.49 1 .63],...
'MarkerSize',20)
set(p(3,:),'LineWidth',2,...
'Color','blue',...
'MarkerEdgeColor','b',...
'MarkerFaceColor',[.49 1 .63],...
'MarkerSize',20)

답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by