matrix_operation.m

来自「matlab 源程序」· M 代码 · 共 37 行

M
37 行
字号
clear;%a fast way to generate a matrix by multiplying a column vector by a row%vectorX = 1:5;M = X'*X;M%generate a complex signalt = 0:1e-3:10;z = exp(-2*i*pi*t);%x and y are the real and imaginary part of zx =real(z);y = imag(z);figure(2);plot(t, x);hold on;    grid on;plot(t, y, 'r');legend('real part', 'imaginary part');%rho and theta are the magnitude and phase of zrho = abs(z);theta = angle(z);figure(3);plot(t, rho);hold on;    grid on;plot(t, theta, 'r');legend('magnitude', 'phase');%z_conj is the conjugate of zz_conj = conj(z);figure(4);plot(t, z+z_conj-2*x);hold on;    grid on;plot(t, z-z_conj-2*i*y,'r');legend('difference in (z+z_conj-2real)', 'difference in (z-z_conj-2j imag)');

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?