Why won't my function graph?
显示 更早的评论
x = linspace(0,10,100);
y = 3*exp(-x/3)*sin(pi*x);
plot(x, y)
xlabel('Time in Seconds')
ylabel('Voltage over time')
回答(1 个)
Voss
2021-12-4
You have to use .* (element-wise multiplication) rather than * (matrix multiplication):
y = 3*exp(-x/3).*sin(pi*x);
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!