用Matlab创建余弦函数

时间:2014-12-09 21:31:50

标签: matlab function cosine

我想在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

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

1 个答案:

答案 0 :(得分:1)

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 function design