-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Figure 13.5 #2
Comments
Pasting your code exactly worked for me (though the code was missing a few
* in the plot lines). Maybe you redefined some variables? Please try
clearing the workspace and starting again from the top of the code.
…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(2*pi*frequency.
*time),'m','linew',2) plot(time,sin(2*pi*frequency.*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
<#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
|
That worked! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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(2pi*frequency.*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.
The text was updated successfully, but these errors were encountered: