使用 Matlab 创建余弦函数



我想在 Matlab 中创建一个函数,它采用参数:A,w0,omega,n1,nf

function A*cos(wb*n + omega) =fcosine(A,w0,omega,n1,nf)
n=n1:nf;
wb = w0;
xb = A*cos(wb*n + omega);
subplot(4,1,2), stem(n, xb)
grid
end

我正在努力做对,有什么想法吗?

function xb = fcosine(A, w0, omega, n1, nf)
    n = n1:nf;
    wb = w0;
    xb = A*cos(wb*n + omega);
    subplot(4,1,2), stem(n, xb)
    grid
end

但是你应该重新考虑你的 Matlab 函数设计。

最新更新