Question

MOD bug? Or something else?

Seems to be a bug in *MOD*. The values inside the range from 0 to 1 that should result in *MOD* of 0 (or 0 to machine precision...

9 years ago | 2 answers | 0

Answered

looking for an efficient way to activate all fprintf in the function

Probably not what you are looking for, but a quick way may be to just do a search and replace all (i.e., search for: "fprintf" r...

looking for an efficient way to activate all fprintf in the function

Probably not what you are looking for, but a quick way may be to just do a search and replace all (i.e., search for: "fprintf" r...

9 years ago | 0

Answered

How to manipulate Plot Legend to show markers and colours seperatly?

It can be done... you will have to do some finagling, but it can be done. Here is an example where we have 2 different datasets ...

How to manipulate Plot Legend to show markers and colours seperatly?

It can be done... you will have to do some finagling, but it can be done. Here is an example where we have 2 different datasets ...

9 years ago | 7

Answered

How to check if a file of certain type exists in folder?

You could try doing something like: dir_struct = dir( fullfile(your_path,'*pdf') ); if numel(dir_struct) == 0 % then ...

How to check if a file of certain type exists in folder?

You could try doing something like: dir_struct = dir( fullfile(your_path,'*pdf') ); if numel(dir_struct) == 0 % then ...

9 years ago | 0

Answered

Plotting lognormal data on this type of graph?

The key ended up being *norminv*. Here is an example output of the program I made (see below for *probit* function): >> pro...

Plotting lognormal data on this type of graph?

The key ended up being *norminv*. Here is an example output of the program I made (see below for *probit* function): >> pro...

9 years ago | 0

| accepted

Question

Plotting lognormal data on this type of graph?

I would like to plot data on a graph similar to that illustrated in the figure below (except it is upside-down from my conventio...

9 years ago | 2 answers | 0

Answered

I have a rather large matrix. The data was sampled at 100 Hz. I want to the data to look like it was sampled at 5 Hz

Use *resample* - This is an example of why you may not want to take every Nth amplitude: <<https://lh5.googleusercontent.com/...

I have a rather large matrix. The data was sampled at 100 Hz. I want to the data to look like it was sampled at 5 Hz

Use *resample* - This is an example of why you may not want to take every Nth amplitude: <<https://lh5.googleusercontent.com/...

9 years ago | 0

Answered

use FFT in matlab and get phase plot

Here are the frequencies associated with the output from FFT: Nt = % Number of time samples Fs = ...

use FFT in matlab and get phase plot

Here are the frequencies associated with the output from FFT: Nt = % Number of time samples Fs = ...

9 years ago | 0

| accepted

Answered

Area of a Spectrum

The area under your curve should just be: N = numel(x); dt = 1/fs; df = fs/N; y = fft(x)*dt; area_y = sum(abs(y))*d...

Area of a Spectrum

The area under your curve should just be: N = numel(x); dt = 1/fs; df = fs/N; y = fft(x)*dt; area_y = sum(abs(y))*d...

9 years ago | 0

| accepted

Answered

How to get back complete signal after doing IFFT

Can you provide an example of how you are performing the fft? Something like: a = your_dataset_in_the_time_domain; size_a ...

How to get back complete signal after doing IFFT

Can you provide an example of how you are performing the fft? Something like: a = your_dataset_in_the_time_domain; size_a ...

9 years ago | 0

Answered

ifft and fft problem

Did you mean to use "fs_s" instead of "f_s" here: h1_s_hat = abs(fs_s.*ifft(ifftshift(h1_s_FT))); I guess that's why you...

ifft and fft problem

Did you mean to use "fs_s" instead of "f_s" here: h1_s_hat = abs(fs_s.*ifft(ifftshift(h1_s_FT))); I guess that's why you...

9 years ago | 0

| accepted

Answered

MATLAB Answers Wish-list #2 (and bug reports)

I kind of wish that when we scrolled through the answers to questions (especially when there are many "answers" like this one), ...

MATLAB Answers Wish-list #2 (and bug reports)

I kind of wish that when we scrolled through the answers to questions (especially when there are many "answers" like this one), ...

9 years ago | 0

Answered

Is there a built-in function that determines whether X/Y coordinates give valid polygon?

My attempt: % Assume polygon is valid answer = 1; % Set tolerance tol = 0.001; % Random set...

Is there a built-in function that determines whether X/Y coordinates give valid polygon?

My attempt: % Assume polygon is valid answer = 1; % Set tolerance tol = 0.001; % Random set...

9 years ago | 0

Question

Is there a built-in function that determines whether X/Y coordinates give valid polygon?

If I have a vector of X-coordinates and a vector of Y-coordinates, is there a function that determines whether a valid polygon i...

9 years ago | 3 answers | 1

Answered

How do you centre your plot at '0' on the X-axis after performing a Fourier transform?

*fftshift* might be what you are looking for. Does this example help? dt = 0.1; % Fs = 1/dt; N = 16; t = (0:N-1)*dt; ...

How do you centre your plot at '0' on the X-axis after performing a Fourier transform?

*fftshift* might be what you are looking for. Does this example help? dt = 0.1; % Fs = 1/dt; N = 16; t = (0:N-1)*dt; ...

9 years ago | 0

Answered

how is a Shock response spectrum estimated

You might take a look at this FEX submission: <http://www.mathworks.com/matlabcentral/fileexchange/7398-shock-response-spectr...

how is a Shock response spectrum estimated

You might take a look at this FEX submission: <http://www.mathworks.com/matlabcentral/fileexchange/7398-shock-response-spectr...

9 years ago | 0

| accepted

Answered

2D spectral energy density using fft2 - energy in spatial domain unequal to that in wavenumber domain

*[EDIT 7/06]* M=8;N=16; N=8;M=16; dx=0.1;dy=0.2; f = randn(M,N); % Energy in time domain energy_f = sum(sum(f.^2...

2D spectral energy density using fft2 - energy in spatial domain unequal to that in wavenumber domain

*[EDIT 7/06]* M=8;N=16; N=8;M=16; dx=0.1;dy=0.2; f = randn(M,N); % Energy in time domain energy_f = sum(sum(f.^2...

9 years ago | 1

| accepted

Answered

How can I choose a subset of k points the farthest apart?

Added a few more tests (including your latest) and added your data (instead of just random dataset), which may be of interest. R...

How can I choose a subset of k points the farthest apart?

Added a few more tests (including your latest) and added your data (instead of just random dataset), which may be of interest. R...

9 years ago | 0

Answered

Simple question for GUI

Also wanted to add a good resource for those who want to learn how to program a variety of things in Matlab GUIs: <http://www...

Simple question for GUI

Also wanted to add a good resource for those who want to learn how to program a variety of things in Matlab GUIs: <http://www...

9 years ago | 0

| accepted

Answered

Bandpass Filter By Using Butter

Okan - Ambient noise is like random noise... the frequency domain response (if you were to plot the abs of the frequency domain ...

Bandpass Filter By Using Butter

Okan - Ambient noise is like random noise... the frequency domain response (if you were to plot the abs of the frequency domain ...

9 years ago | 0

Answered

How can I choose a subset of k points the farthest apart?

Went with a "simple" way - tried to maximize the sum of the distances between each point in the sub-set of "n" below (similar to...

How can I choose a subset of k points the farthest apart?

Went with a "simple" way - tried to maximize the sum of the distances between each point in the sub-set of "n" below (similar to...

9 years ago | 0

Answered

Legend Problem

Matlab is only doing what you tell it to. One of the places where you define your figure, you have your "hold on" just after you...

Legend Problem

Matlab is only doing what you tell it to. One of the places where you define your figure, you have your "hold on" just after you...

9 years ago | 0

Answered

MATLAB Answers Wish-list #2 (and bug reports)

Has someone already addressed the change from having our most recent answers listed first to (now) where our oldest answers are ...

MATLAB Answers Wish-list #2 (and bug reports)

Has someone already addressed the change from having our most recent answers listed first to (now) where our oldest answers are ...

9 years ago | 1

Answered

FFT

Your first amplitude represents 0 frequency. When your data has 0 mean, your first amplitude should also be 0.

FFT

Your first amplitude represents 0 frequency. When your data has 0 mean, your first amplitude should also be 0.

9 years ago | 0

Answered

derivative using FFT properties

Based on the website below: <http://www.cl.cam.ac.uk/teaching/2000/ContMaths/JGD-notes/node11.html> I believe you would do...

derivative using FFT properties

Based on the website below: <http://www.cl.cam.ac.uk/teaching/2000/ContMaths/JGD-notes/node11.html> I believe you would do...

9 years ago | 0

| accepted

Answered

cycles/pixel to cycels/degree

See this link: <http://www.cogs.susx.ac.uk/courses/acv/matlab_demos/fft_image_demo.html> About half way down: F = fft...

cycles/pixel to cycels/degree

See this link: <http://www.cogs.susx.ac.uk/courses/acv/matlab_demos/fft_image_demo.html> About half way down: F = fft...

9 years ago | 0

Answered

FFT of an image

See my answer here for a coded up description of what the 2D Fourier transform does using a random 2D image as an example (shoul...

FFT of an image

See my answer here for a coded up description of what the 2D Fourier transform does using a random 2D image as an example (shoul...

9 years ago | 0

| accepted

Answered

why real part of fft (exp(at)) is negative in some parts in contrary to analytical calculation of fft(exp(at))?

Try plotting the *abs* result from FFT. Basically, you will not get a purely real, all positive frequency spectrum unless your t...

why real part of fft (exp(at)) is negative in some parts in contrary to analytical calculation of fft(exp(at))?

Try plotting the *abs* result from FFT. Basically, you will not get a purely real, all positive frequency spectrum unless your t...

9 years ago | 0

Answered

Area of a triangle

How about *polyarea*? >> x = [0, 0, 4]; >> y = [0, 3, 0]; >> area1 = polyarea(x,y) area1 = 6 >> area2 =...

Area of a triangle

How about *polyarea*? >> x = [0, 0, 4]; >> y = [0, 3, 0]; >> area1 = polyarea(x,y) area1 = 6 >> area2 =...

9 years ago | 2

| accepted