matlab大神求助小小问题!

2025年05月09日 11:17
有2个网友回答
网友(1):

你是漏了 ],zeros前面的[,在后面没有对应],
这样就可以了
plot([x;x],[zeros(1,4);[1 2 2 1]])
plot([x;x],[zeros(1,4);[1 2 2 1]])

网友(2):

改:
x=2:2:8;
y=[1, 2 ,2 ,1];
subplot(221);
plot([x;x],[zeros(1,4);[1 ,2, 2 ,1])
plot([x;x],[zeros(1,4);[1 ,2, 2, 1])

试试