How to represent a curve with straight line segments?
14 次查看(过去 30 天)
显示 更早的评论
Luis Eduardo Pacheco González
2022-7-1
评论: Luis Eduardo Pacheco González
2022-7-4
I'm trying to plot the curve segment on the left with line segments only, as the figure in the right. I know there's a function to plot lines but in this problem I need to overlap the lines, with given length, onto the curve and i don't know the coordinates because i'm working with sin and cos curves
0 个评论
采纳的回答
Sam Chak
2022-7-3
编辑:Sam Chak
2022-7-3
Hi @Luis Eduardo Pacheco González
Just wondering if you want to display a smooth sinusoidal curve like this?
Or, if you are asking for a mathematical solution for computing each line segment that can be used to construct the curve?
subplot(2,1,1)
x = linspace(0, 2*pi, 361);
y = sin(x);
plot(x, y, 'linewidth', 1.5)
grid on, ylim([-1.5 1.5])
subplot(2,1,2)
x = linspace(0, 2*pi, 360/45+1);
y = sin(x);
plot(x, y, 'linewidth', 1.5)
grid on, ylim([-1.5 1.5])
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!