Convolution built-in function
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
What are conv function updates as I can't run this code conv(RC,plot(amp)) without error Error: using conv2 Invalid data type. First and second arguments must be numeric or logical., Thing do not happen in version 13 !!
3 Kommentare
John D'Errico
am 19 Apr. 2017
That would not have worked in any rational way in version 13 either. plot will return a handle to the plot, so totally useless in terms of any convolution.
Akzeptierte Antwort
dpb
am 19 Apr. 2017
Bearbeitet: dpb
am 20 Apr. 2017
What John and Stephen said. What you appear to want (and wanted originally) is just
synthetic=conv(RC,amp);
which would be the convolution of RC and the amp kernel.
Prior to HG2 (handle graphics 2), graphics and other handles were just numeric values (doubles) so arithmetic operations on them were not illegal and so you didn't get an error in earlier release but the answer was nonsensical. Now, handles are a new class and so such erroneous operations can be flagged as errors.
You will want to revisit any calculations done earlier as they are in error; the result would have been just a constant times the vector.
R2012b
>> h=plot(rand(4,1))
h =
174.0016
>> whos h
Name Size Bytes Class Attributes
h 1x1 8 double
>> conv(h,1:4)
ans =
174.0016 348.0032 522.0048 696.0063
>> [1:4]*h
ans =
174.0016 348.0032 522.0048 696.0063
>>
R2014b
>> h=plot(rand(3,1))
>> h
h =
Line with properties:
...
>> whos h
Name Size Bytes Class Attributes
h 1x1 60 matlab.graphics.chart.primitive.Line
>>
>> double(h)
ans =
1.2207e-04
>>
So, you see that prior to HG2 plot returned a double that was a floating point value; the specific value is dependent upon each invocation, but 175+/- is typical. OTOH, with HG2 as R2014b shows, the handle is a class variable and you can't see the numeric value unless you cast it to double and you see the numeric value is grossly different.
Either, way, using the line handle in conv makes no sense computationally, whatsoever.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
