Answered
how to plot a mean line in a plot
‘I need to mean line to be at the same angle as my fluctuations.’ You apparently want the linear regression of ‘u1’ as a functi...

3 years ago | 1

| accepted

Answered
3D mesh plot
The ‘x’ vector is missing a ‘30’ value (supplied here). I get a different result when I plot those data — x = [0 10 20 30 0...

3 years ago | 0

Answered
How to change a parameter in a model
Try something like this — A = @(h,k) [ -1 0 0; -1 h k; 0 0 -3]; % Create As Anonymous Function B = [ 1; 1; ...

3 years ago | 0

Answered
How to Smooth signal data to find clean peaks
I am not certain what you want. One option is simply to use a lowpass filter, then adjust the ‘CutoffFreq’ variable until you ...

3 years ago | 0

| accepted

Answered
3d plot from knows XYZ
It will be necessary to interpolate them to create a surface. There are seeral ways to interpolate them, my favourite being t...

3 years ago | 1

Answered
Data fitting to a function that has the dependent y variable on both sides of the equation
I would do something like this — x = (1:10).'; y = rand(size(x)); B0 = rand(3,1); [B,fval] = fminunc(@(b)norm(y - b(1).*s...

3 years ago | 0

Answered
Trend lines with moving average
It is unlikely that it is posssible to get any meanigful information from these unless they are first sorted. LD = load(websa...

3 years ago | 0

| accepted

Answered
60 years of daily data; need to group separately by month and year
One approach for the mean values — T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1307475/Flow...

3 years ago | 0

| accepted

Answered
How to sort data in a bar plot based on its values on Y-axis?
I assume the x-data are categorical, because otherwise this is straightforward. Perhaps this — x = 1:5; y = rand(1,5); xl...

3 years ago | 1

| accepted

Answered
LogLog Plot is Blank
Use element-wise division: y = (B.*x)/((log(A.*x) - log(log(1 + 1/GamSE)))*dM); ↑ ← HERE and it works! %Paschen...

3 years ago | 0

| accepted

Answered
Can integral3 be used to have integrals over 9 variables?
A 3D vector would seem to me to be a 3D matrix. If so, trapz used repetitively on each dimension of the matrix would likely be ...

3 years ago | 0

Answered
plot a graph from user input
Use the inputdlg function instead. You can list everything you want responses to in one call to it, and even create default opt...

3 years ago | 0

Answered
I would like to count the number of peaks of a signal.
Use the signal Processing Toolbox findpeaks function to count the peaks. The plotted signal does not appear to be noisy, so it ...

3 years ago | 0

| accepted

Answered
How make a high pass filter and give input to it simultaneously?
‘There are functions on matlab like Highpass but it doesn't pass an input signal into it.’ Yes, it does! The input signal ...

3 years ago | 0

Answered
Fixing fzero in standard normal distribution
Change the initial parameter estimate to something other than 0. The fzero function is a root-finding algorithm, so it looks fo...

3 years ago | 1

| accepted

Answered
Choose frequency to plot and create sound
These frequencies are going to be too low to hear, so consider multiplying them by perhaps 100 in the sound call. Fs = 44100...

3 years ago | 0

Answered
How can I add error bars to a stacked plot?
A (slightly tortured) tiledlayout array might work — x = 0:0.5:10; y = randn(3,numel(x)); err = randn(3,numel(x))/5; figu...

3 years ago | 1

| accepted

Answered
Save results if fminsearch in a table or m.file
I assume that ‘a’, ‘xi’, and ‘phi’ are parameters returned (in that order) by fminsearch. If so, then perhaps this — U_v...

3 years ago | 0

| accepted

Answered
lsqnonlin providing very poor model fits
With a few edits to make it more efficient, this seems to work — A=lsqnonlin(@insulin_prediction,[2 2 2 2],[0 0 0 0]) functio...

3 years ago | 0

| accepted

Answered
butterworth and baseline removal filtering
The ‘baseline wander filter’ is a bandpass filter with a passband of 0.5 to 15 Hz. (This is too restrictive in my opinion. The...

3 years ago | 0

Answered
How to use Nlinfit for a function with two independent variables?
You are using the correct approach with: xm=[x1 x2]; In the function, refer to ‘x1’ as ‘xm(:,1)’ and ‘x2’ as ‘xm(:,2)’ , pas...

3 years ago | 0

| accepted

Answered
Warning: Error updating FunctionLine. for fplot
Evaluate all the functions. Try this — y1 = 0; addi = 0.05; aoamid = (2*0.6*sqrt(1-((y1)/4)^2)/(pi^2)+0.6/(8*pi)) CLnew ...

3 years ago | 0

Answered
Having trouble creating a for loop for this code. I want to use a for loop instead of having five commands as seen in the code.
Perhaps — prefx = {'r','f','g','l','x'}; for k = 1:numel(prefx) data{k} = load(sprintf('%s.dat',prefx{k}) end prefx = ...

3 years ago | 1

| accepted

Answered
Grouping Categories in Scatter Plot
The gscatter function may be appropriate. Is this the correct file? These don’t appear to have anything to do with rivers (a...

3 years ago | 0

Answered
R2022B Update4 is not offered
Try this — Get R2022b Update 4 That’s where I had to go to get it. .

3 years ago | 0

Answered
matlab does not plot the time series
The problem is that ‘velocity_jonswap’ is uniformaly NaN. This is causec by a ‘0/0’ , ‘Inf/Inf’ or NaN values in the data used ...

3 years ago | 0

| accepted

Answered
how can i plot including sym data in graph?
Thia approach works — fs=3000; t= 0 : 1/fs : 10; t = 0: 1/fs : 2.5; % Substitute To A...

3 years ago | 0

| accepted

Answered
Same calcuation, but hand-result is different from code result
This simply appears to be a precision issue. Using round on the intermediate results provides the same result as the calculator...

3 years ago | 0

Answered
How to extract column index based on value in another column?
Try something like this — A = [2 4 1 3 2; 3 1 4 2 3; 2 4 1 3 4; 4 2 3 1 4; 1 3 2 4 4]; T1 = array2table(A, 'VariableNames',{...

3 years ago | 0

| accepted

Answered
How to assign 0 or 1 randomly to the coordinates?
I am not certain what you want to do. Perhaps this — x = linspace(-2,2,10) ; y = linspace(-2,5,10) ; [X,Y] = meshgrid(x,...

3 years ago | 0

| accepted

Load more