I am new to Matlab and I am trying to implement a section of a published paper, the basic idea of the part that i am implementing is to show the frequency spectrum of camera aperture. The shutter exposure is represented by images on the left side and their frequency spectrum on the right side as shown in the following image.

What the first image represents is that the camera shutter remains open for the entire duration of the exposure time (hence the continuous block). The next 3 images show flutter shutter where the shutter opens and closes according to a binary sequence (white means closed and non-white means open) during the exposure time. Frequency Spectrums

I want to draw these blocks according to a coded sequence of length 52, as well as their frequency spectrum. The coded sequence for first block is all 1's, for second block its alternating 1's and 0's, for the third block its random binary sequence, and for the last block its 1010000111000001010000110011110111010111001001100111.

Can anyone guide me how to achieve this in Matlab? How do i draw these blocks according to the described binary sequence and plot their frequency spectrum? Any help would be highly appreciated.

  • $\begingroup$ "How to plot this data" is not a signal processing, but a matlab usage question. So, let's focus on the signal processing question: Are you familiar with the Fourier Transform? $\endgroup$ – Marcus Müller May 22 '19 at 19:11
  • $\begingroup$ Yes i am. Plotting the abs(fftshift(fft(x))) where x is the binary sequence, is never giving me the plots as shown in the figure. $\endgroup$ – Raja Ayaz May 23 '19 at 6:58
  • $\begingroup$ How much did you zero-pad the sequence before applying the fft? Remember that the FFT/DFT just maps time (or space) domain vectors of length N to frequency domain vectors of length N, i.e. if you want high frequency resolution, you'll need to add zeros (or repitions of the original signal) to the end of your input signal before transforming it. $\endgroup$ – Marcus Müller May 23 '19 at 7:45
  • $\begingroup$ Thank you so much @MarcusMüller, i did not zero padded the binary sequence. Now i am getting plot which is kind of similar to the image shown in question, but not exactly like that. Here is my code. a = rem(1:52,2); % alternating 1's and 0's a = [a zeros(1,52)]; % zero padding plot(fftshift(abs(fft(a)))); The plots that i am getting are shown here (ibb.co/YPkGgSX). You can see the original image plots are looking inverted, any idea how to obtain the exact same plots as the original image? $\endgroup$ – Raja Ayaz May 23 '19 at 14:27
  • $\begingroup$ well, you need to zero pad exactly like the authors did, maybe also window. We can't guess what they did. $\endgroup$ – Marcus Müller May 23 '19 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.