[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question about conv
From: |
Walter White |
Subject: |
Re: Question about conv |
Date: |
Fri, 16 Dec 2011 13:29:12 +0100 |
Thanks for your responses. I downloaded both versions and they work
with 3.2.4, too.
But now there is another problem:
I am not sure what I am doing wrong. I tried to get familiar with the
conv-function
by smoothing a randomized scatter added to a sine.
But the result is not what I expected. Can you please have a look at my
code and tell me what I am doing wrong?
----------
sigma = 0.1;
center = 0;
x = -10:0.1:10
convolution_kernel = 1/(sigma * sqrt(2*pi) ) * exp(-0.5 * (x -
center).^2 /(sigma^2));
plot(x,convolution_kernel)
hold on
random_scatter = sin(x)+ (0.5*rand(size(x)))
plot (x,random_scatter,'r-')
conv_random_scatter =
conv_recent_release(random_scatter,convolution_kernel,"same")
plot (conv_random_scatter,'g-')
axis([-20,20]);
-------------
Kind regards,
Walter
2011/12/15, Ben Abbott <address@hidden>:
>
>
>
>
> On Dec 15, 2011, at 3:15 PM, Walter White <address@hidden>
> wrote:
>
>> Am 15.12.2011 17:14, schrieb James Sherman Jr.:
>>> On Thu, Dec 15, 2011 at 11:00 AM, Walter White
>>> <address@hidden <mailto:address@hidden>> wrote:
>>>
>>> Hello,
>>>
>>> I have a question about conv():
>>>
>>> The *documentation at
>>> *http://octave.sourceforge.net/octave/function/conv.html says,
>>> that it is possible to use the parameter "shape" to cut the result
>>> of the convolution
>>> down to the original vector.
>>>
>>> But this does not work for me.
>>>
>>> conv(random_scatter,gaussian,"same")
>>>
>>> error: Invalid call to conv. Correct usage is:
>>>
>>> -- Function File: conv (A, B)
>>>
>>>
>>> I had a look into conv.m and it does not seem to accept
>>> that parameter at all. I am using version 3.2.4.
>>> Has "shape" been implemented recently and 3.2.4 is too old?
>>>
>>> Kind regards,
>>> Walter
>>>
>>>
>>> The shape parameter does look like a new addition. If you type "help
>>> conv" at the octave prompt what comes up?
>>>
>>> I have 3.2.4 and it does not have support for the shape parameter.
>>>
>>> Hope this helps,
>>
>> I already tried that. The parameter "shape" is not documented there.
>> Is is possible to extract just the conv.m from a newer release
>> or do I have to compile the new version from scratch?
>
> I don't know if it will work for you, but the most recent version is at the
> link below.
>
> http://hg.savannah.gnu.org/hgweb/octave/file/421c892fd526/scripts/polynomial/conv.m
>
> Ben
>