필터 지우기
필터 지우기

Line and scattered data on one plot

조회 수: 1 (최근 30일)
Daniel
Daniel 2016년 2월 17일
답변: Walter Roberson 2016년 2월 17일
I have three polynomials,
y_150 = @(x) 22*((x-23)/4.9)^4 - 48*((x-23)/4.9)^3 + 27*((x-23)/4.9)^2 - 37*((x-23)/4.9) + 40;
y_200 = @(x) 11*((x-19)/4.8)^4 - 48*((x-19)/4.8)^3 + 73*((x-19)/4.8)^2 - 72*((x-19)/4.8) + 48;
y_212 = @(x) 23*((x-19)/4.8)^4 - 43*((x-19)/4.8)^3 + 22*((x-19)/4.8)^2 - 40*((x-19)/4.8) + 41;
Which I plot using ,
for i = 9:1:25
n = n + 1;
y_15(n) = y_150(i);
y_20(n) = y_200(i);
y_21(n) = y_212(i);
end
figure;
plot(9:1:25,y_15)
hold on
plot(9:1:25,y_20)
hold on
plot(9:1:25,y_21)
But, now I use these curves to calculate certain events. eg,
life_log{event_log} = [n_yaw(i,2) y_150(n_yaw(i,2))];
I then end up with a cell array,
life_log = [9,1041] [12,506] [12,506] [12,506] [15,191] [15,191] [15,191] [15,191] [21,63] [9,1041] [9,1041] [9,1041];
Which I then transform into a matrix,
life = cell2mat(life_log');
So... My question is how do I plot these scattered points on the same graph of the curves?

채택된 답변

Walter Roberson
Walter Roberson 2016년 2월 17일
You already have "hold on" in effect, so just
scatter(life(:,1), life(:,2))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by