这个 MATLAB 表达式有什么问题?

What is wrong in this MATLAB expression?

我需要实现功能

5cos((x^4)/3)tan(exp(0.2x))cos(ln(4x))

在 MATLAB 中将其绘制在具有 1000 个元素的域 [-PI, PI] 内。

x = linspace(-pi, pi, 1000);
y = 5*cos((x.^4)/3).*cos(log(x*4)).*tan(exp(x*0.2));
plot(x,y);

这就是我所做的。它给了我 this plot, but this plot is incorrect. According to many online plotting tools (Wolfram, GrapSketch, Rechneronline...) the plot should look like this.

为什么 MATLAB 绘制的图如此不同?代码有错吗?

您发布的两个情节的积极部分相同。只需放大您的 matlab 绘图,添加

axis([-pi pi -50 50])

plot(x,y) 之后。

不确定为什么您的 "target" 绘图没有显示绘图的负面部分。