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...

4 years 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',...

4 years 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...

4 years 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...

4 years 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...

4 years 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...

4 years 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 ...

4 years 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...

4 years ago | 0

| accepted

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...

4 years 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_...

4 years 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)) %...

4 years 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...

4 years 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,...

4 years 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]; ...

4 years ago | 1

| 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...

4 years ago | 2

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...

4 years ago | 0

| accepted

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'...

4 years 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',...

4 years 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...

4 years ago | 1

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...

4 years 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...

4 years 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....

4 years ago | 1

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...

4 years 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...

4 years 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))...

4 years 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...

4 years 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...

4 years 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...

4 years ago | 0

| accepted

Answered
help with formatting the title of a set of graphs
Using the sprintf function is one option — i = 1; runType = 'Reducing'; samples{1} = 'AK STEEL'; title(sprintf('Area and \\...

4 years ago | 0

| accepted

Answered
How to plot colorbar and plot size different?
One option would be to stretch the figure by adjusting the 'Position' property. It is possible to re-position it and stretch (o...

4 years ago | 0

| accepted

Load more