Undefined function 'sqrt' for input arguments of type 'char'.

7 次查看(过去 30 天)
Hello,
i have problem when running my CWT,
it say :
Undefined function 'sqrt' for input arguments of type 'char'.
Error in cwt (line 278)
coefs(ind,:) = -sqrt(a)*wkeep1(diff(wconv1(ySIG,f)),lenSIG);
Error in Test (line 21)
cwt(bigcircle_ant2_data,'amor',1); %produce plot-morlet
mother wavelet
load bigcircle_p1
[p,s,mu]=polyfit((1:numel(bigcircle_ant2))',bigcircle_ant2,20);
f_y=polyval(p,(1:numel(bigcircle_ant2))',[],mu);
bigcircle_ant2_data=bigcircle_ant2 - f_y;
figure (1)
cwt(bigcircle_ant2_data,'amor',Fs);
[wt,f,coi]=cwt(bigcircle_ant2_data,'amor',Fs);
tms=(0:numel(bigcircle_ant2_data)-1)/Fs;
set(gcf,'color','w','units','normalized','outerposition',[0 0 1 1]);
% get index of maximum value of returned matrix
[~,tmp]=max(wt);
[~,tmp2]=max(max(wt));
ind=[tmp(tmp2),tmp2];
% get frequency of maximum
max_freq_ant1 = frq(ind(1));
% get time of maximum
max_time_ant1 = (ind(2)-1)*1/Fs;
figure (2)
subplot(2,1,1)
plot(tms,bigcircle_ant2_data)
axis tight
title('Signal and Scalogram of 1.58 GHz Circle Patch Antenna 1')
xlabel('Time(s)')
ylabel('Amplitude')
grid on
subplot(2,1,2)
surface(tms,frq,abs(wt))
axis tight
shading flat
xlabel('Time(s)')
ylabel('Frequency (Hz)')
set(gca,'yscale','log')
hold on
y=line([tms(1) tms(end)], [frq(ind(1)) frq(ind(1))],'Color','m','LineWidth',2);
view([0 90])
h=get(gca,'Children');
set(gca,'Children',[h(2) h(1)])
set(gcf,'color','w','units','normalized','outerposition',[0 0 1 1]);

回答(1 个)

Walter Roberson
Walter Roberson 2020-8-9
cwt(bigcircle_ant2_data,'amor',1); %produce plot-morlet
You are using the calling syntax for newer versions of cwt(). In the version of MATLAB you are using, the second parameter of cwt had to be numeric, not character vector.
doc cwt
Or the old version is documented at https://www.mathworks.com/help/wavelet/ref/cwtold.html

类别

Help CenterFile Exchange 中查找有关 Continuous Wavelet Transforms 的更多信息

标签

产品


版本

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by