Zame
Zame

Reputation: 320

Creating Cosine Function with Matlab

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

Answers (1)

Michael Dorner
Michael Dorner

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

Related Questions