Answered

How to add Data Labels to Graph

I can’t run the code because of missing data. Instead of using num2str, use the compose function: text(x,y,compose('%.2f',c...

How to add Data Labels to Graph

I can’t run the code because of missing data. Instead of using num2str, use the compose function: text(x,y,compose('%.2f',c...

8 days ago | 0

| accepted

Answered

How to plot two different scripts on one graph

Use the hold funciton — t = linspace(0, 100, 1001)*0.1; s1 = sin(2*pi*t); s2 = s1*1.5; figure plot(t, s1, 'DisplayName',...

How to plot two different scripts on one graph

Use the hold funciton — t = linspace(0, 100, 1001)*0.1; s1 = sin(2*pi*t); s2 = s1*1.5; figure plot(t, s1, 'DisplayName',...

8 days ago | 0

Answered

estimate parameter from kinetic model

The problem (one of them) is here [t,Cv] = ode45(@(t,C)subpro(t,C,p),ts,C0); The argument to ode45 needs to be ‘t’, not ‘ts’:...

estimate parameter from kinetic model

The problem (one of them) is here [t,Cv] = ode45(@(t,C)subpro(t,C,p),ts,C0); The argument to ode45 needs to be ‘t’, not ‘ts’:...

8 days ago | 0

Answered

Why it comes up with the imaginary number?

The first raises 0.6 to the 0.1 power, then negates it. The second takes -0.6 to the 0.1 power, and taking a non-integer powe...

Why it comes up with the imaginary number?

The first raises 0.6 to the 0.1 power, then negates it. The second takes -0.6 to the 0.1 power, and taking a non-integer powe...

8 days ago | 1

| accepted

Answered

Finding corresponding values in data set

I would just do the interpolation using interp1 since it will interpolate to 0 or the closest value to it. Try this — M = r...

Finding corresponding values in data set

I would just do the interpolation using interp1 since it will interpolate to 0 or the closest value to it. Try this — M = r...

8 days ago | 0

| accepted

Answered

how to define a frequenty domain to do an FFT over?

It would help to have an example. The fft function requires that the original data be sampled at regular intervals. The easi...

how to define a frequenty domain to do an FFT over?

It would help to have an example. The fft function requires that the original data be sampled at regular intervals. The easi...

8 days ago | 0

| accepted

Answered

How can I optimize the FFT of very large arrays

One option may be to be certain that the original signal so that its length is zero-padded to a power of 2: Fs = 256; t = lin...

How can I optimize the FFT of very large arrays

One option may be to be certain that the original signal so that its length is zero-padded to a power of 2: Fs = 256; t = lin...

8 days ago | 0

Answered

How to find second order transfer function of tfestimate result

The tfestimate function may not be the funciton you want. Instead, use invfreqs (continuous) or invfreqz (sampled) to estimate ...

How to find second order transfer function of tfestimate result

The tfestimate function may not be the funciton you want. Instead, use invfreqs (continuous) or invfreqz (sampled) to estimate ...

8 days ago | 1

| accepted

Answered

How can we threshold a signal in both positive and negative sides?

I am not certain what you want as the result. The for loop and if block are not necessary. You can do this with logical inde...

How can we threshold a signal in both positive and negative sides?

I am not certain what you want as the result. The for loop and if block are not necessary. You can do this with logical inde...

8 days ago | 0

Answered

How do you remove non-integer values from a colorbar?

This required some coding gymnastics, however it may be what you want — cm = [1 0 0; 1 1 1; 0 0 1]; % Basi...

How do you remove non-integer values from a colorbar?

This required some coding gymnastics, however it may be what you want — cm = [1 0 0; 1 1 1; 0 0 1]; % Basi...

9 days ago | 1

Answered

lsqcurvefit with custom equation

There is a problem with ‘f’ since it is not obvioul what parameters are to be estimated. The function should be: f(parameter_...

lsqcurvefit with custom equation

There is a problem with ‘f’ since it is not obvioul what parameters are to be estimated. The function should be: f(parameter_...

9 days ago | 0

| accepted

Answered

How do you remove tick marks (not labels) from a colorbar?

Try this — cm = [1 0 0; 1 1 1; 0 0 1]; % Basic Colormap cmi = interp1([-2; 0; 5], cm, (-2:5)) %...

How do you remove tick marks (not labels) from a colorbar?

Try this — cm = [1 0 0; 1 1 1; 0 0 1]; % Basic Colormap cmi = interp1([-2; 0; 5], cm, (-2:5)) %...

9 days ago | 1

| accepted

Answered

Double conversion to use prctile function

I am not certain what ‘Model’ is, however if it resembles this array, indexing into it as a cell array is straightforward — Mo...

Double conversion to use prctile function

I am not certain what ‘Model’ is, however if it resembles this array, indexing into it as a cell array is straightforward — Mo...

9 days ago | 1

| accepted

Answered

Convert x y coordinates and z data to Matrix

It would help to have the actual vectors. It may be possible to use the reshape function to create matrices from the vectors,...

Convert x y coordinates and z data to Matrix

It would help to have the actual vectors. It may be possible to use the reshape function to create matrices from the vectors,...

9 days ago | 0

| accepted

Answered

How do I make a red and blue colormap?

I am not exactly certain what you want, however the basic colormap is easy to create — cm = [1 0 0; 1 1 1; 0 0 1]; ...

How do I make a red and blue colormap?

I am not exactly certain what you want, however the basic colormap is easy to create — cm = [1 0 0; 1 1 1; 0 0 1]; ...

9 days ago | 0

| accepted

Answered

Decomposing the time series of wind turbulance using Fourier series, and computing the spectra.

Try this — T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1125355/data-MOOCTurbulenceDataSerie...

Decomposing the time series of wind turbulance using Fourier series, and computing the spectra.

Try this — T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1125355/data-MOOCTurbulenceDataSerie...

10 days ago | 1

Answered

extract a section of a vector and plot

Perhaps something like this — t = linspace(0, 10, 250); s = sin(2*pi*t); figure plot(t,s) grid [pks,locs] = findpeaks...

extract a section of a vector and plot

Perhaps something like this — t = linspace(0, 10, 250); s = sin(2*pi*t); figure plot(t,s) grid [pks,locs] = findpeaks...

10 days ago | 0

Answered

Multiple population Genetic Algorithm

I am not exactly certain what a ‘Multiple Population Genetic Algorithm’ would be. It is certainly possible to define your own '...

Multiple population Genetic Algorithm

I am not exactly certain what a ‘Multiple Population Genetic Algorithm’ would be. It is certainly possible to define your own '...

10 days ago | 0

Answered

Converting a time field (+000:00:00) in a table to a usable format

Use the second function with the 'secondoofday' argument (or whatever you want from it) — format long G dt = datetime('now'...

Converting a time field (+000:00:00) in a table to a usable format

Use the second function with the 'secondoofday' argument (or whatever you want from it) — format long G dt = datetime('now'...

10 days ago | 0

Answered

Filter signal with 2 different frequencies

Use either the bandpass or bandstop functions, depending on the result you want. For best results, use the 'ImpulseResponse',...

Filter signal with 2 different frequencies

Use either the bandpass or bandstop functions, depending on the result you want. For best results, use the 'ImpulseResponse',...

10 days ago | 0

| accepted

Answered

Add 2 sec. of noise as a reference for a spectrogram infront of a 2 second long sinus function.

Try this — fs = 44200; % Sampling frequency (samples per second) dt = 1/fs; % second...

Add 2 sec. of noise as a reference for a spectrogram infront of a 2 second long sinus function.

Try this — fs = 44200; % Sampling frequency (samples per second) dt = 1/fs; % second...

10 days ago | 0

Answered

How can I have for loop show me each histogram it created rather then play it like a movie?

I am not certain what you are doing or the result you want. I don’t see an end for the for loop, so I assume everything is in t...

How can I have for loop show me each histogram it created rather then play it like a movie?

I am not certain what you are doing or the result you want. I don’t see an end for the for loop, so I assume everything is in t...

11 days ago | 0

| accepted

Answered

How do you get realistic textures when shading graphs?

I am not certain what result you want. One option is to interpolate the ‘mycolors’ matrix — x = @(r, t) r.*cos(t); y = @(r...

How do you get realistic textures when shading graphs?

I am not certain what result you want. One option is to interpolate the ‘mycolors’ matrix — x = @(r, t) r.*cos(t); y = @(r...

11 days ago | 0

Answered

Converting tremor data in to frequency and filter data

The fft plots are straightforward, however only the acceleration signals make sense. The ‘Gyr’ signals exhibit broadband noise....

Converting tremor data in to frequency and filter data

The fft plots are straightforward, however only the acceleration signals make sense. The ‘Gyr’ signals exhibit broadband noise....

11 days ago | 0

Answered

PLOT surface using 3 vectors of same length (NEED HELP!!!)

The code produces vectors, so I would simply reshape them, using the number of unique elements in ‘i’ to determine one of the di...

PLOT surface using 3 vectors of same length (NEED HELP!!!)

The code produces vectors, so I would simply reshape them, using the number of unique elements in ‘i’ to determine one of the di...

11 days ago | 0

Answered

Find rows based on set of values/codes

I am not certain what you want, however the ismember function might be a better option than find for this, especially since ever...

Find rows based on set of values/codes

I am not certain what you want, however the ismember function might be a better option than find for this, especially since ever...

11 days ago | 0

| accepted

Answered

Solve implicit equation for isentropic flow

When in doubt, plot the function — Aratio=4; g=1.4; % fcn = @(M) (1./M).*((2/(g+1)).*(1+(((g-1)/2).*M.^2)).^((g+1)/(2*(g-1))...

Solve implicit equation for isentropic flow

When in doubt, plot the function — Aratio=4; g=1.4; % fcn = @(M) (1./M).*((2/(g+1)).*(1+(((g-1)/2).*M.^2)).^((g+1)/(2*(g-1))...

11 days ago | 0

| accepted

Answered

Remove periodic noise in Raman spectra by FFT

I have no idea what your spectra look like, however removing truly periodic noise would likely be appropriate for a digital filt...

Remove periodic noise in Raman spectra by FFT

I have no idea what your spectra look like, however removing truly periodic noise would likely be appropriate for a digital filt...

12 days ago | 0

Answered

RF filer design Matlab

I don’t have the RF Toolbox (since I don’t need it, although earlier as a U.S. Amateur Extra Class Amateur Radio operator, it wo...

RF filer design Matlab

I don’t have the RF Toolbox (since I don’t need it, although earlier as a U.S. Amateur Extra Class Amateur Radio operator, it wo...

12 days ago | 0

Answered

How to generate a nonlinear equation from MATLAB?

Try something like this — X=[0 1 1.1 1.15]; Y=[0 0.0042 0.0097 0.016]; fcn = @(b,x) b(1) .* exp(b(2).*x); format long [B...

How to generate a nonlinear equation from MATLAB?

Try something like this — X=[0 1 1.1 1.15]; Y=[0 0.0042 0.0097 0.016]; fcn = @(b,x) b(1) .* exp(b(2).*x); format long [B...

12 days ago | 0

| accepted