I want to write a function in matlab, that would do the following:
Given linear space of periodic functions, and given an orthogonal set in this space, I want to write a function that accepts as an argument a periodic function and the orthogonal set, and calculates the projection of the periodic function on each of the functions in the orthogonal set.
i.e, the arguments of the function are:
1)Vector which contains values of a periodic function
2)Matrix with N columns such that each column contains values of one of the orthogonal functions
3)Scalar - T which represents the period.
And the function should return a vector which contains the projections of the periodic function on each of the orthogonal functions. Meaning, the vector should return the coefficients .
Here's what I have tried:
function [coeff] = mekadmim_bekef(xt, M, T)
time_vector = 0:num_of_samples:T;
conj_column=conj(curr_column)
num_to_int = xt.*conj_column;
deno_to_int = curr_column.*conj_column;
numerator = trapz(time_vector,num_to_int);
denominator = trapz(time_vector,deno_to_int);
coeff(k)=numerator./denominator;
But when I try to test it with the following code:
a=mekadmim_bekef(f1',M,T);
It dosent work.
What went wrong?
Thanks in advance.