【发布时间】:2018-06-10 09:30:30
【问题描述】:
这段代码
fplot(@sin, [0 4], 'LineWidth', 2)
在 MATLAB 中工作,但使用 Octave 会给出错误消息。如何在 Octave 中设置fplot 的曲线宽度?
【问题讨论】:
这段代码
fplot(@sin, [0 4], 'LineWidth', 2)
在 MATLAB 中工作,但使用 Octave 会给出错误消息。如何在 Octave 中设置fplot 的曲线宽度?
【问题讨论】:
Dimitry’s answer 可能更好,不过你也可以找到线柄并修改:
fplot(@sin, [0 4])
h = findobj(gca, 'type', 'line');
set(h, 'LineWidth', 2)
【讨论】:
Octave 在不常用的区域中充满了错误。这可能就是其中之一。
改用普通的plot 函数。
%get data
[x,y]=fplot(@sin, [0 4]);
%or
x=0:0.1:4; y=sin(x);
%plot data
plot(x,y, 'LineWidth', 10)
%or
l=plot(x,y);
set(l,'LineWidth', 10)
【讨论】:
fplot 有两个输出参数会被 Mathworks 折旧。 MATLAB R2018a 还警告它在未来版本中的删除,并建议改用 XData 和 YData 属性。