Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Computing product of cell
Replies: 1   Last Post: Mar 11, 2014 4:53 PM

 Messages: [ Previous | Next ]
 Zulfiquar Posts: 1 Registered: 3/11/14
Computing product of cell
Posted: Mar 11, 2014 4:04 PM

n=5;
L=8;
c=cell((n+1)^2,1);
xprod = cell((n+1)^2,(n+1)^2);
h=ones(size(c));
C=zeros((n+1)^2,L*L);
wayC=zeros(2,L*L);
w = 0:pi/(L-1):pi;
i=0;
for k = 0:n;
for j=0:n;
i=i+1;
c{i} = @(w1,w2)cos(k.*w2).*cos(j*w1);
end
end
for i=0:n;
xprod{i+1} = @(w1,w2)(c{i+1}.*c');
end
for k=1:L;
C(:,(k-1)*L+1:k*L)=cell2mat(cellfun(@(dc) dc(w(k),w),xprod,'Uniformoutput',false));
end

Hello,
I wanted to run the above code. But I got an error message which I could not fix. Here is the error message I am getting in MATLAB

Undefined function 'times' for input arguments of type 'function_handle'.

Error in @(w1,w2)(c{i+1}.*c')

Error in @(dc)dc(w(k),w)

Error in gen_BigC (line 24)
C(:,(k-1)*L+1:k*L)=cell2mat(cellfun(@(dc)
dc(w(k),w),xprod,'Uniformoutput',false));

Can anyone help me how to fix the problem? Thank you

Date Subject Author
3/11/14 Zulfiquar
3/11/14 Steven Lord