2016-04-21 148 views
-2

funcplot使用1000 线性间隔数据点在间隔[-pi,pi]上绘制以下函数。如何使用数组来实现?我没有任何想法。在matlab中绘制函数与阵列

F(X)= 5cos(X4 /3)黄褐色(E 0.2× )COS(LN(4×))

+1

['plot'](http://www.mathworks.com/help/matlab/ref/plot.html) – excaza

回答

0

你需要首先定义一个阵列,用于x

x = linspace(-pi, pi, 1000); 

然后你需要计算f的数组x

f = 5 * cos(x * 4/3) .* tan(exp(0.2 * x)) .* cos(log(4 * x)); 

然后使用plot绘制xf

%// Plot the real components 
plot(x, real(f)); 

%// Plot the imaginary components 
plot(x, imag(f));