Reputation: 320
I Would like to create a function in Matlab that takes the parameters: 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
i am struggling doing it right, any thoughts?
Upvotes: 0
Views: 276
Reputation: 20195
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
But you should re-think about your Matlab function design.
Upvotes: 1