DSPRelated.com
Forums

Order of convolution and multiplying

Started by ejs June 18, 2008
Hi all,

I have three signals in the frequency domain, which arranged in
mathematical way as follow:

The first signal (named as M) is multiplied with a signal (named as R)
that blocks some frequency components and transmits the others, and the
result is convolved with the first signal (M).

My question is, what are the mathematical operations that I have to do if
I need to rearrange the order such that M is convolved with itself, and
then to take in account R.



>The first signal (named as M) is multiplied with a signal (named as R) >that blocks some frequency components and transmits the others, and the >result is convolved with the first signal (M).
Multiplication with R can not block some frequency components and leave others unless they are separated in time. You might want to double check your requirements and compare to what you are doing. What kind of signals are R and M? Why do you need such an operation? Multiplication and convolution do not commute in general. It may be possible if either of your signals is a sinusoid. Emre
On Jun 18, 6:58 pm, "emre" <egu...@ece.neu.edu> wrote:
> >The first signal (named as M) is multiplied with a signal (named as R) > >that blocks some frequency components and transmits the others, and the > >result is convolved with the first signal (M). > > Multiplication with R can not block some frequency components and leave > others unless they are separated in time. You might want to double check > your requirements and compare to what you are doing. What kind of signals > are R and M? Why do you need such an operation? > > Multiplication and convolution do not commute in general. It may be > possible if either of your signals is a sinusoid. >
If M and R are frequency-domain representations, then R can mask certain frequency bands if it's zero for certain regions. However yes, in general, convolution and multiplication do not commute. -- Oli
ejs wrote:
> Hi all, > > I have three signals in the frequency domain, which arranged in > mathematical way as follow: > > The first signal (named as M) is multiplied with a signal (named as R) > that blocks some frequency components and transmits the others, and the > result is convolved with the first signal (M). > > My question is, what are the mathematical operations that I have to do if > I need to rearrange the order such that M is convolved with itself, and > then to take in account R.
You are doing this in the frequency domain? So in the time domain you are filtering m (M's time-domain equivalent) with r (r's time domain equivalent), then multiplying by m? That's all very interesting, but it makes no sense. Particularly when the answer to your third paragraph is just "do what you said". Perhaps if you gave some more context, someone could give you a sensible answer, or at least tell you why your problem statement can never be sensible. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html
>On Jun 18, 6:58 pm, "emre" <egu...@ece.neu.edu> wrote: >> >The first signal (named as M) is multiplied with a signal (named as
R)
>> >that blocks some frequency components and transmits the others, and
the
>> >result is convolved with the first signal (M). >> >> Multiplication with R can not block some frequency components and
leave
>> others unless they are separated in time. You might want to double
check
>> your requirements and compare to what you are doing. What kind of
signals
>> are R and M? Why do you need such an operation? >> >> Multiplication and convolution do not commute in general. It may be >> possible if either of your signals is a sinusoid. >> > >If M and R are frequency-domain representations, then R can mask >certain frequency bands if it's zero for certain regions. > >However yes, in general, convolution and multiplication do not >commute. > > >-- >Oli >
Thanks all, Let me explian my problem in more detais. The signal M is a fourier transform of a random matrix, and R is a low pass filter. I make a simulation in the freq. domain. m = rand(64); M = fftshift(fft2(fftshift(m-mean(m(:))))); R = zeros(64); R(28:36,28:36)=1; Also I have a target image o, o = double(rgb2gray(imread('***.bmp'))); O = fftshift(fft2(fftshift(o-mean(o(:))))); In the case that I don't use the low pass the order of the simulation is: result = conv2(conv2(O,M),M); Since m is a random matrix, conv2(M,M) gives strong delta function (DC value) plus very small energy in the rest of the spectrum. In this case I can change the order of the simulation (without changing the result, of course), result = conv2(conv2(M,M),O); by taking conv2(M,M) first, I can suppress the very small energy from the spectrum and keep the DC value, and then to make a convolution with O which exactly reconstruct O. In the case that I do use the low pass the simulation is: result_lpf = conv2((conv2(O,M).*R),M); My problem is, how do I suppress these tiny energy components from the spectrum (and keep the DC value) in this case.
On Jun 19, 9:46&#4294967295;am, "ejs" <eyal...@gmail.com> wrote:
> >On Jun 18, 6:58 pm, "emre" <egu...@ece.neu.edu> wrote: > >> >The first signal (named as M) is multiplied with a signal (named as > R) > >> >that blocks some frequency components and transmits the others, and > the > >> >result is convolved with the first signal (M). > > >> Multiplication with R can not block some frequency components and > leave > >> others unless they are separated in time. You might want to double > check > >> your requirements and compare to what you are doing. What kind of > signals > >> are R and M? Why do you need such an operation? > > >> Multiplication and convolution do not commute in general. It may be > >> possible if either of your signals is a sinusoid. > > >If M and R are frequency-domain representations, then R can mask > >certain frequency bands if it's zero for certain regions. > > >However yes, in general, convolution and multiplication do not > >commute. > > >-- > >Oli > > Thanks all, > > Let me explian my problem in more detais. > > The signal M is a fourier transform of a random matrix, and R is a low > pass filter. I make a simulation in the freq. domain. > > m = rand(64); > M = fftshift(fft2(fftshift(m-mean(m(:))))); > R = zeros(64); > R(28:36,28:36)=1; > > Also I have a target image o, > > o = double(rgb2gray(imread('***.bmp'))); > O = fftshift(fft2(fftshift(o-mean(o(:))))); > > In the case that I don't use the low pass the order of the simulation is: > > result = conv2(conv2(O,M),M); > > Since m is a random matrix, conv2(M,M) gives strong delta function (DC > value) plus very small energy in the rest of the spectrum. In this case I > can change the order of the simulation (without changing the result, of > course), > > result = conv2(conv2(M,M),O); > > by taking conv2(M,M) first, I can suppress the very small energy from the > spectrum and keep the DC value, and then to make a convolution with O which > exactly reconstruct O. > > In the case that I do use the low pass the simulation is: > > result_lpf = conv2((conv2(O,M).*R),M); > > My problem is, how do I suppress these tiny energy components from the > spectrum (and keep the DC value) in this case.
I think the first question would be "why are you convolving your frequency-domain representations?" This does not filter your images; conv2(conv2(O,M),M) is equivalent to element-wise multiplying your image o with m^2, which is presumably not what you're trying to achieve. -- Oli
"Oli Charlesworth" <catch@olifilth.co.uk> wrote in message 
news:4dd3321e-c446-486c-9a89-5e528e4b7575@x35g2000hsb.googlegroups.com...
> On Jun 18, 6:58 pm, "emre" <egu...@ece.neu.edu> wrote: >> >The first signal (named as M) is multiplied with a signal (named as R) >> >that blocks some frequency components and transmits the others, and the >> >result is convolved with the first signal (M). >> >> Multiplication with R can not block some frequency components and leave >> others unless they are separated in time. You might want to double check >> your requirements and compare to what you are doing. What kind of signals >> are R and M? Why do you need such an operation? >> >> Multiplication and convolution do not commute in general. It may be >> possible if either of your signals is a sinusoid. >> > > If M and R are frequency-domain representations, then R can mask > certain frequency bands if it's zero for certain regions. > > However yes, in general, convolution and multiplication do not > commute.
Oli, Well, it's pretty early in the morning here and I'm not sure my brain is fully in gear. Multiplication in frequency is "the same" as convolution in time - if properly done, etc. Convolution commutes so .... ? I must be missing something here. What is it? Fred
On Jun 19, 1:50&#4294967295;pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org>
wrote:
> "Oli Charlesworth" <ca...@olifilth.co.uk> wrote in message > > news:4dd3321e-c446-486c-9a89-5e528e4b7575@x35g2000hsb.googlegroups.com... > > > > > On Jun 18, 6:58 pm, "emre" <egu...@ece.neu.edu> wrote: > >> >The first signal (named as M) is multiplied with a signal (named as R) > >> >that blocks some frequency components and transmits the others, and the > >> >result is convolved with the first signal (M). > > >> Multiplication with R can not block some frequency components and leave > >> others unless they are separated in time. You might want to double check > >> your requirements and compare to what you are doing. What kind of signals > >> are R and M? Why do you need such an operation? > > >> Multiplication and convolution do not commute in general. It may be > >> possible if either of your signals is a sinusoid. > > > If M and R are frequency-domain representations, then R can mask > > certain frequency bands if it's zero for certain regions. > > > However yes, in general, convolution and multiplication do not > > commute. > > Oli, > > Well, it's pretty early in the morning here and I'm not sure my brain is > fully in gear. &#4294967295;Multiplication in frequency is "the same" as convolution in > time - if properly done, etc. &#4294967295;Convolution commutes so .... ? &#4294967295;I must be > missing something here. &#4294967295;What is it? >
As far as I can make out from the OP, he/she wants to do both multiplication and convolution in the frequency domain. -- Oli
"Oli Charlesworth" <catch@olifilth.co.uk> wrote in message 
news:d857a75c-a3be-4ca3-9a41-53f88a463b71@y21g2000hsf.googlegroups.com...
On Jun 19, 1:50 pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org>
wrote:
> "Oli Charlesworth" <ca...@olifilth.co.uk> wrote in message > > news:4dd3321e-c446-486c-9a89-5e528e4b7575@x35g2000hsb.googlegroups.com... > > > > > On Jun 18, 6:58 pm, "emre" <egu...@ece.neu.edu> wrote: > >> >The first signal (named as M) is multiplied with a signal (named as R) > >> >that blocks some frequency components and transmits the others, and > >> >the > >> >result is convolved with the first signal (M). > > >> Multiplication with R can not block some frequency components and leave > >> others unless they are separated in time. You might want to double > >> check > >> your requirements and compare to what you are doing. What kind of > >> signals > >> are R and M? Why do you need such an operation? > > >> Multiplication and convolution do not commute in general. It may be > >> possible if either of your signals is a sinusoid. > > > If M and R are frequency-domain representations, then R can mask > > certain frequency bands if it's zero for certain regions. > > > However yes, in general, convolution and multiplication do not > > commute. > > Oli, > > Well, it's pretty early in the morning here and I'm not sure my brain is > fully in gear. Multiplication in frequency is "the same" as convolution in > time - if properly done, etc. Convolution commutes so .... ? I must be > missing something here. What is it? >
As far as I can make out from the OP, he/she wants to do both multiplication and convolution in the frequency domain. Oli, Yes, that's what I read too. But you didn't answer my question.. :-) Fred