mikexcohen / AnalyzingNeuralTimeSeries

Code for ANTS book (Cohen, 2012, MIT Press)
170 stars 76 forks source link

Figure 13.5 #2

Open hsisti opened 1 year ago

hsisti commented 1 year ago

I'm trying to re-create Figure 13.5 and am receiving an error message. I've copied the code I'm using from the file and the error message I receive below. Thanks for writing such a great book!

%% Figure 13.5

% redefine time time = -.5:1/srate:.5; % vector of time

figure

% plot real and imaginary parts of wavelet plot(time,real(wavelet),'linew',2) hold on plot(time,imag(wavelet),':','linew',2)

% plot cosine and sine plot(time,cos(2pifrequency.time),'m','linew',2) plot(time,sin(2pifrequency.time),'m:','linew',2)

% plot gaussian window gaus_win = exp(-time.^2./(2*s^2)); plot(time,gaus_win,'k') set(gca,'ylim',[-1.2 1.2]) xlabel('Time (s)') legend({'real part of wavelet';'imaginary part of wavelet';'cosine';'sine';'Gaussian'})

Error using plot Vectors must be the same length.

mikexcohen commented 1 year ago

Pasting your code exactly worked for me (though the code was missing a few

On Fri, May 5, 2023 at 3:08 PM Helene Sisti @.***> wrote:

I'm trying to re-create Figure 13.5 and am receiving an error message. I've copied the code I'm using from the file and the error message I receive below. Thanks for writing such a great book!

%% Figure 13.5

% redefine time time = -.5:1/srate:.5; % vector of time

figure

% plot real and imaginary parts of wavelet plot(time,real(wavelet),'linew',2) hold on plot(time,imag(wavelet),':','linew',2)

% plot cosine and sine plot(time,cos(2pifrequency. time),'m','linew',2) plot(time,sin(2pifrequency.time),'m:','linew',2)

% plot gaussian window gaus_win = exp(-time.^2./(2*s^2)); plot(time,gaus_win,'k') set(gca,'ylim',[-1.2 1.2]) xlabel('Time (s)') legend({'real part of wavelet';'imaginary part of wavelet';'cosine';'sine';'Gaussian'})

Error using plot Vectors must be the same length.

— Reply to this email directly, view it on GitHub https://github.com/mikexcohen/AnalyzingNeuralTimeSeries/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARKKLI6GZFRMRTNYUGPEXUDXETUVRANCNFSM6AAAAAAXXA4VAY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Mike X Cohen, PhD Fresh look: mikexcohen.com

hsisti commented 1 year ago

That worked!