Plot 2 curves on the same graph (with function and data)

조회 수: 4 (최근 30일)
rasse_uo
rasse_uo 2023년 12월 2일
댓글: rasse_uo 2023년 12월 2일
I want to plot 2 curves on 1 graph. However, one curve is a function (f) so I would usually use fplot. The other curve is found with data (t30, A30). I tried to plot them on the same graph but it doesnt work. Can someone help me please? Thank you
  댓글 수: 2
Walter Roberson
Walter Roberson 2023년 12월 2일
Because you divide t30 by 1000, your t30 will end up slightly over 0.1 apart from each other. To reach as high as the [0 10] upper bound of the fplot, you would need to be plotting about 95-ish points. Do you have that many?
It is not generally a problem to hold on and plot over an fplot, provided that the range of values is large enough to cover a notable fraction of the area.
syms x
f = x^2 .* cos(x)
f = 
fplot(f, [0 10])
hold on
plot(0:5, [.1 .5 -.1 3 4 -2])
rasse_uo
rasse_uo 2023년 12월 2일
Yes I have 125 points. It works now, thank you!

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by