Answered
Logical Indexing With LinSpace Issues
format long X = linspace(0.2,3,29) %Creates an array going from 0.2 -> 3 via steps of 0.1. So 1.3 is in it. disp(X(12)) fl...

3 years ago | 2

| accepted

Answered
Shaded error area of Std Dev.
It would of course help to have your data. However this call: std_y = std(P_all,0,2); implies to me that your data are col...

3 years ago | 0

| accepted

Answered
z=f(x,y) and w=f(x,y). I am trying to reverse the table to get x=f(z,w) and y=f(z,w).
Apparently, X, Y, Z and W are all equal-sized matrices. Assuming that there is essentially a one-to-one correspondence between ...

3 years ago | 0

Answered
Plot data in matlab
Isn’t that just this — Scaled = @(data,Th) [data(:) ones(size(data(:)))] * ([Th 1; 0 1] \ [1; 0]); % Scale Data By Thresho...

3 years ago | 1

| accepted

Answered
I have a problem in the annexed excel file there are two tables, first table give the graph representing geological layers I need to get the second table with Matlab Code
One approach — C1 = readcell('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1315950/Salt%20Dome%20Interpretat...

3 years ago | 0

Answered
Hi , all there , i have an excel file that i want to split it by special element value in the file to some files . how can i make it possoble with matlab
To begin a new sub-array whenever a zero appears in any row, this works — M = randi([0 20], 15, 4) ZeroInRow = any(M==0,2); ...

3 years ago | 0

Answered
How to find troughs of a signal below a threshold
Use the 'MinPeakHeight' name-value pair — t = linspace(0, 2*pi, 500); s = sin(2*pi*t) - sin(2*pi*0.1*t-0.45); Threshold ...

3 years ago | 1

Answered
How do I fill colour on both sides of the sin wave in this graph?
Using the patch function — % Define the time axis (x-axis) t = linspace(0, 12, 1000); % Define the parameters of the sinusoi...

3 years ago | 0

Answered
code is right but can not the a plot
You need to redefine ‘t’ so that it matches the row size of ‘u’: t = linspace(0, 2.5, size(u,1)); Try this — % clear % cl...

3 years ago | 0

| accepted

Answered
Plot several time series data stacked in one graph
Try this — T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1314900/Data.xlsx') VN = T1.Propert...

3 years ago | 1

| accepted

Answered
Data normalization with threshold
I am not certain what you want to do. Perhaps one of these — data = [10,30,50,75]; threshold_value = [70]; Result = no...

3 years ago | 1

| accepted

Answered
How to save the scatter plot with and without transparency
The gca function (of course) is ‘get current axes’, and it does exactly that. One option is to save an axes reference in each s...

3 years ago | 0

| accepted

Answered
Undefined function 'geomean' for input arguments of type 'double' in Matlab 2020
An alternative is: gm = @(x) prod(x)^(1/numel(x)); x = rand(1,100); y1 = geomean(x) y2 = gm(x) .

3 years ago | 2

Answered
Extracting specific data from time range excel
It would help to have the Excel file. The ‘1 data raeading per hour’ request is open to intpretation. First, convert the t...

3 years ago | 1

| accepted

Answered
Normalize the amplitude of a sinewave of varying amplitude and frequency
‘I need to determine each "cycle" by detecting zero crossings and the peaks and valleys, then determining the peak and vally for...

3 years ago | 0

Answered
How can I remove a pulse from a soundwave?
If the pulse is at a single frequency with known bandwidth, just use a bandstop filter. If there is energy at several frequenci...

3 years ago | 2

Answered
Don't know how to fix error preallocating for speed
It’s likely not an error, simply a suggestion that preallocating for speed would be advisable. (A preallocated loop generally r...

3 years ago | 0

Answered
How to create for loop
You need to convert the numeric vectors into polynomials in before taking the inverse Laplace transform of them. Even then, th...

3 years ago | 0

| accepted

Answered
Detecting peaks and valleys in signal
I do not have your data. See if the 'MinPeakDistance' name-value pair will help to isolate them. Experiment with it to ignor...

3 years ago | 1

| accepted

Answered
How to separate time series data?
It depends how they are formatted. Assuming the times are a datetime array — t = datetime(1,1,1) + seconds(0:0.5:15).'; s ...

3 years ago | 0

Answered
Need to create a table with values from a bode plot
One approach would be to use the freqresp function with, for example: w = [1; 10; 100]; then calculate the magnitude and phase...

3 years ago | 1

| accepted

Answered
Z must be a matrix, not a scalar or vector.
It would be helpful to have the actual data rather than a ‘proxy problem’. The ‘Z’ vector should have the dame number of elemen...

3 years ago | 1

| accepted

Answered
adding cells of two arrays
Perhaps something like this — A = {[10,9,13,21,18] [9,9,11,18,18]}; B = {[11,10,12,20,19] [10,9,13,21,18]}; C = cellfun(@(...

3 years ago | 1

Answered
Reconstruction of a Signal from the Real Part of Its Discrete Fourier Transform for matlab
No. You will need the complex part (or equivalently, the phase information) to accurately reconstruct the signal. Otherwise,...

3 years ago | 0

Answered
extracting unique numbers from a cell array
One approach — G{1} = [1]; G{2} = [1]; G{3} = [2,3,4]; G{4} = [4,5]; Len2 = cellfun(@(x)numel(x)>=2, G) Gu = unique([G{...

3 years ago | 1

| accepted

Answered
fmincon and choosing different initial values
The Global Optimization Toolbox has a number of functions that can search the parameter space for different initial parameter es...

3 years ago | 0

Answered
In this code, I want to find out slope at every value of x?
Try something like this — x=[10.33 10.331 10.332 10.333 10.334 10.335 10.336 10.337 10.338 10.339 10.34 10.341 10.342 10.343 1...

3 years ago | 0

Answered
Smoothing a noisy signal
Experiment with this approach — LD = load(websave('pressure','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1...

3 years ago | 0

Answered
How can I access Ydata from interaction plots?
Using an example from the interactionplot documentation — rng default; % For reproducibility y = randn(1000,1); % Rand...

3 years ago | 0

Answered
Changing a parameter in a trasferire function
I demonstrated this in your earlier post: How to change a parameter in a model. The same approach applies here — s = tf('s'...

3 years ago | 0

| accepted

Load more