Error using matlab.gra​phics.axis​.Axes/set

조회 수: 1 (최근 30일)
ARIJIT GHOSH
ARIJIT GHOSH 2019년 9월 10일
Hi,
I am using some else's code from a publication, I am adding the code below:
% Script written by Tanya Leise, Department of Mathematics, Amherst College
% Calls scripts wavetrans.m and ridgewalk.m from jlab written by J. M. Lilly
% (http://www.jmlilly.net/jmlsoft.html)
%
% Also uses custom scripts Actogram.m, CalcScaleForCWT.m, and CWTPlotLabels.m
%
% This script plots the analytic wavelet transform of a mouse wheel-running record.
% Also calculates and plots the wavelet ridge curves.
clear all
longestperiod=30;
shortestperiod=20;
gamma=3;beta=7; % always use gamma=3, decrease beta to increase time resolution (at expense of frequency resolution)
filename = 'OUTSYNC 170 Wheel-TimeSeries.csv';
M=dlmread(filename,',',1,0);
t=M(:,1);
Nsteps=numel(t);
wheel=M(:,2);
light=M(:,3);
clear M
NstepsPerHr=4;TimeStep=1/NstepsPerHr; % wheel revolutions are in 15 minute bins
T=t(Nsteps)-t(1);
Actogram(wheel,NstepsPerHr,T,'new',24);title(filename);
nvoice=512;
[fs,tau,qscaleArray] = CalcScaleForCWT(shortestperiod,longestperiod,T,NstepsPerHr,nvoice);
cwt=wavetrans(wheel,{1,gamma,beta,fs,'bandpass'},'periodic'); % cwt is a matrix with complex numbers (jlab)
[ir,jr,xr,fr]=ridgewalk(cwt,fs); % find the the wavelet ridges (jlab)
frange=2*92:2*210;
fig0=figure;set(fig0,'OuterPosition',[100 500 800 400]);
imagesc(abs(cwt(:,frange))');colorbar; % plots the wavelet transform coefficients, which give the amplitude
hold on;scatter(ir,jr-frange(1)+1,4,'k','filled') % plots the ridges
CWTPlotLabels(0,T,NstepsPerHr,nvoice,qscaleArray(frange),'integer',tau(frange),shortestperiod,longestperiod,24,2,4);
set(gca,'YDir','normal');
ir=ir(~isnan(ir));jr=jr(~isnan(jr));
dawn=[3.2472:25.2472 25.9139:31.9139 32.5806:62.5806];
dawnind=round((dawn*24-t(1))*NstepsPerHr+1);
dawnir=interp1(ir,1:numel(ir),dawnind);
arg=angle(cwt(ir+Nsteps*(jr-1)));
phase=mod(arg(dawnir)*12/pi,24);
figure;plot(dawn,phase,'k','LineWidth',2)
set(gca,'FontSize',30,'XTick',4:8:60);axis([0 64 0 10]);
xlabel('Time in days');ylabel('Phase (h)')
tridge=t(ir)/24;
ampl=abs(cwt(ir+Nsteps*(jr-1)));
period=tau(jr);
fig1=figure;set(fig1,'OuterPosition',[0 500 600 450]);
[AX,H1,H2] = plotyy(tridge,period,tridge,ampl,'plot');
set(AX(1),'FontSize',24,'PlotBoxAspectRatio',[1 .65 1],'XTick',44:4:60,...
'XLim',[42 61.75],'YLim',[22 25],'YTick',22:25,'YColor','k','Position',[0.14 0.18 0.69 0.80]);
set(AX(2),'FontSize',24,'PlotBoxAspectRatio',[1 .65 1],'XTick',44:4:60,...
'XLim',[42 61.75],'YLim',[340 510],'YTick',350:50:500,'YColor','k','Position',[0.14 0.18 0.69 0.80]);
set(get(AX(1),'Ylabel'),'String','Period (h)','Color','k','FontSize',24)
set(get(AX(2),'Ylabel'),'String','Amplitude','Color','k','FontSize',24)
xlabel('Time in days')
set(H1,'Color','k','LineWidth',2);set(H2,'Color','k','LineStyle','-.','LineWidth',2)
legend('Period','Amplitude','Location','SouthWest')
This is throwing me an error even with the sample data:
Error using matlab.graphics.axis.Axes/set
Value must be a vector of type single or double whose values increase
Error in CWTPlotLabels (line 34)
set(gca,'YTickLabel',C,'YTick',qticks);
Error in WheelWithShiftsAWTexample (line 40)
CWTPlotLabels(0,T,NstepsPerHr,nvoice,qscaleArray(frange),'integer',tau(frange),shortestperiod,longestperiod,24,2,4);
Help will be much appreciated.
Best,
Arijit

답변 (0개)

카테고리

Help CenterFile Exchange에서 Continuous Wavelet Transforms에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by