Show Kevinunread, Jul 14, 2009, 11:16:03 PM7/14/09 to Hello I'm trying to make two matrices and use fourier transforms to effectively take a 3D convolution of the functions that the matrices represent. My code is as follow: function
W= Nconvolve(t_end, beamdistance, i1,i2,j) for h=(1:length(k)) end x1= (-.004:.001:.004); for f= (1:length(x1)) Q(:,:,h)=F; end; X= fft([D zeros(1,length(Q)-1)]); Y= fft([Q zeros(1,length(New)-1)]); W= ifft(X.*Y); but when i run this, it tells me that "Assignment has more non-singleton rhs dimensions than non-singleton Error in ==> Nconvolve at 23 and I cannot figure out why. Any advice? Thanks in advance. Alan Bunread, Jul 14, 2009, 11:37:01 PM7/14/09 to "Kevin " <> wrote in message <h3i3v3$rn6$>... This doesn't exactly answer your question, but do you know about convn, or fftn? Also, your triple loop doesn't really make sense. For one, you can eliminate the 'e' and 'f' loops by using meshgrid and computing F for vector arguments
instead of scalar. sigma_x and sigma_z are constant so they should be defined outside the loop. Q doesn't seem to depend on h, so why are you looping over h? You might use repmat instead. Kevinunread, Jul 15, 2009, 1:57:05 AM7/15/09 to Well I am trying to make Q a 3D matrix that has the value of F through each step of time (represented by h), so by looping through h I
was attempting to fill the 3D matrix with the solution to F at each time point. I just don't understand why that causes an error. Bruno Luongunread, Jul 15, 2009, 3:00:18 AM7/15/09 to "Kevin " <> wrote in message <h3idd1$opj$>... > Well I am trying to make Q a 3D matrix that has the value of F through each step of time (represented by h), so by looping through h I was attempting to fill the 3D matrix with the solution to F at each time point. I just don't understand why that causes an error. I see error; but I think it's better you see by yourself. Use DBSTOP IF ERROR, run your code and check the dimensions for Q and F. Bruno
Mattunread, Jul 15, 2009, 4:49:02 AM7/15/09 to "Kevin " <> wrote in message <h3i3v3$rn6$>... As an example, suppose size(F) = [m,n,p,q,r] and you have an assignment like Q(1:m,1:n)=F; This is only a valid assignment if p=q=r=1. Otherwise, you get the error message indicated. matlab U can see a part of my code in MATLAB. when i run it, i receive this error: Task has more non-singleton rhs measurements than non-singleton addendums task has more non-singleton rhs measurements than non-singleton addendums There are numerous inquiries regarding Assignment has more non-singleton rhs measurements than non-singleton addendums Answer : There is a task (giving an incentive to a variable, fundamentally when you use =) where the right-hand side (rhs, the incentive to be given to the variable that is on the lhs) is of another dimensionality than the lhs. The accompanying code delivers a similar mistake, yet in an all the more clear condition. a = zeros(5,1) ;%is 5 by 1; note that a has 1 singleton measurement (the subsequent one) b = zeros(5,5) ;% 5 by 5, no singleton measurement a(:,:) = b ; %error tossed here. |