how to plot this function?
1 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Image Analyst
2022-10-5
编辑:Image Analyst
2022-10-5
Here is one way:
x = linspace(-pi, pi, 1000);
f = zeros(1, length(x));
f(abs(x) <= pi/2) = 1;
plot(x, f, 'b-', 'LineWidth', 2)
ylabel('f');
xlabel('x');
grid on;
and this: MATLAB Academy - Free 2 hour training
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!