필터 지우기
필터 지우기

My plot is not showing the points

조회 수: 55 (최근 30일)
Leticia Campello
Leticia Campello 2018년 2월 8일
편집: Walter Roberson 2018년 2월 8일
I'm trying to write a code and it looks like this:
load ('CT_calibration_numbers.mat')
[a b] = size(CT_calibration.artery);
for i=[1:a]
x = [950 1000 1050 1059]';
y = [CT_calibration.adipose(i,1) CT_calibration.bladder(i,1) CT_calibration.gluteus(i,1)...
CT_calibration.artery(i,1)]';
[curve] = fit(x,y,'poly1');
figure
hold all
y2=curve.p1*x + curve.p2;
plot(x,y2)
xlabel('Density [g/cm^3]');
ylabel('CT Number [HU]');
axis([900 1080 900 1150]);
str = ['y = ',num2str(curve.p1),'*HU + ',num2str(curve.p2)];
text(1000, 960, str) % tells matlab where to put the equation
end
the problem is that when I run the code, the graph is plotted with the linear regression but the points are not shown in the graph.
I would much appreciate if anyone has any tips of how to get this sorted.
Kind Regards,
Leticia Campello
  댓글 수: 2
Birdman
Birdman 2018년 2월 8일
Share your mat file.
Leticia Campello
Leticia Campello 2018년 2월 8일
here's the mat file

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

채택된 답변

John D'Errico
John D'Errico 2018년 2월 8일
Are you saying the original points are not shown on the plot? Of course they are not, since you never plotted them!
You could add a line in there:
plot(x,y,'o')
which would plot the original points.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by