Create matlab plot like the curve plot excel
显示 更早的评论
Is it posible to create a matlab plot like the curve plot in excel ? I want to create a plot between a few points, but the plot makes straight lines between the points, and I want the plot to be with curved lines between the data points as shown in the example. The data labels are not importen.

回答(2 个)
Star Strider
2016-12-27
This is probably as close as MATLAB can approximate that plot:
The Code:
x = [0 10.3 344 0.0];
y = [0 1.8 10 11.8];
yi = linspace(min(y), max(y));
xi = interp1(y, x, yi, 'pchip');
figure(1)
plot(xi, yi)
grid
set(gca, 'YDir','reverse')
txtstr = sprintf('%.1f, %.1f\n', [x' y']');
txtlbl = regexp(txtstr, '\n', 'split');
text(x, y, txtlbl(1:end-1), 'FontSize',8)
The Plot:

dpb
2016-12-27
0 个投票
Answered previously (several times, this is one of better)... <points-on-graph-by-a-curve-not-straight-lines>
类别
在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!