Answered
I am having trouble using lsqcurvefit with an function
Experiment with different values for ‘x0’ since nonlinear parameter estimation routines are very sensitive to the initial parame...

4 years ago | 0

Answered
How to determine the exact intersection between line and two curves
Try this — LD = load(' matlab.mat'); p1 = LD.p1; p2 = LD.p2; x = linspace(0, numel(p1)-1, numel(p1)); idx = find(diff(si...

4 years ago | 0

| accepted

Answered
how to determine the actual location of the spectral peaks using the built-in MATLAB function, fminbnd.
Here is an example of how to get and plot the peak values and locations using the Signal Processing Toolbox findpeaks function —...

4 years ago | 0

| accepted

Answered
Put heatmap color bar on top
See the Location property of the colorbar in Colorbar Properties. That should work. (I rarely use heatmap objects so I canno...

4 years ago | 0

Answered
How to interpret "F-statistics vs. constant model" in the fitnlm function?
That is the probability that the model explains the data better than the mean of the data. The ModelFitVsNullModel property doe...

4 years ago | 0

| accepted

Answered
How can I create a 3D graph with a color map in the range from 0 to 1 ?
Another approach — xg = X_achse_of_geometrie + output_array; yg = Y_achse_of_geometrie + output_array; zg = Z_achse_of_geome...

4 years ago | 0

| accepted

Answered
Splitting Data Into Intervals and Finding the cumulative value
Try this — a = [1.0000 71.8700 2.0000 136.1100 3.0000 151.3500 4.0000 139.1300 5.0000 127.1900 ...

4 years ago | 0

| accepted

Answered
How to plot 2 plots in one for loop with each plot having a legend
Try something like this — x = 1:1:10; y = zeros(10,5); figure; Ax1 = axes; hold on figure Ax2 = axes; hold on fo...

4 years ago | 1

| accepted

Answered
How to add, multiply and subtract two matrices have different length ?
While adding two matrices of different dimensions is not defined mathematically, it is possible to add or subtract them by index...

4 years ago | 0

| accepted

Answered
Taking an inverse spatial fft in MATLAB
The question is a bit ambiguous, and I do not have the frequency and complex amplitude vectors to work with. For a one-sided ...

4 years ago | 0

| accepted

Answered
importdata() function problem
It would be helpful to know what ‘not working’ actually means. Assuming that ‘filelist’ is a cell array, perhaps: filename ...

4 years ago | 0

Answered
How to add contour plot to xz and yz surface to 3d plot
I am not certain what the desired result is. Try this — LD = load('matlab.mat'); figure surf(LD.x, LD.y, LD.V0) hold o...

4 years ago | 0

| accepted

Answered
How do i fit a histogram properly?
Using chi2gof to assess curve fitting of a regression may not be appropriate. T1 = readtable('https://www.mathworks.com/matl...

4 years ago | 0

Answered
I have a program and I need to make a model of it.
My guess is that the code now needs to be made into an objective function to be used with a parameter estimation routine. See...

4 years ago | 1

| accepted

Answered
datetime to string conversion
Ise the 'Format' name-value pair — dayv = datetime(2008,04,01, 'Format','yyyyMMdd') string(dayv) .

4 years ago | 0

| accepted

Answered
Why do I recieve an error "Index in position 1 exceeds array bounds" ?
Try this — desiredlength = 1; % Cut the yEdited audio file to 1 second (First One Second) L = Fs * desired...

4 years ago | 1

| accepted

Answered
How to concatenate a double array and a categorical array?
The way I read the documentation for using a table (the tbl section), and By default, fitglm takes the last variable as the res...

4 years ago | 0

| accepted

Answered
My script is made to process multiple data files, but only outputs one "peak location" value
I would do something like this — for i=1:length(file_list) filename=file_list{i} data_in=readtable([path_n filename]...

4 years ago | 0

| accepted

Answered
Plot surface from Lat/Lon/Depth/Data with different size depth
Try this — LD1 = load('Data.mat'); Data = LD1.Us; LD2 = load('Depth.mat'); Depth = LD2.Depth; LD3 = load('Lat.mat'); Lat ...

4 years ago | 0

Answered
Normalising and rescaling my ultrasonic signal
There are (at least) two functions that can do what you want, one being rescale and the other being normalize. Experiment to...

4 years ago | 0

| accepted

Answered
How to draw a "xline" with a given height for the line and a given vertical position for the text?
The xline function by default goes to the limits if the y-axis. The label only has limited options for positioning. It will ...

4 years ago | 1

| accepted

Answered
Loading a .mat file as a cell and without changing its size
It depends on what is in ‘temp.dat’. If it only contains the cell array, just load it into your workspace. If it contains ot...

4 years ago | 0

Answered
Finding the spatial fourier transform of a function
It depends ono what you want to do. 0 The fft function does not care what the units of the independent variable are, so they c...

4 years ago | 0

| accepted

Answered
How to plot wave function for finite square well? [Physics question]
I do not know what it supposed to look like, however to get a continuous plot, horizongally concatenate the respectrive row vect...

4 years ago | 1

| accepted

Answered
How to repeat element of array to complete Specific shape In matlab
See my Answer to How to repeat element of array to complete Specific shape In matlab EDIT — (11 Mar 2022 at 6:14) There is o...

4 years ago | 0

Answered
plotting a symbolic array of functions
Use the matlabFunction function to convert the symbolic functions into functions that can be used numerically. Then, if ‘theta...

4 years ago | 0

| accepted

Answered
How to repeat element of array to complete Specific shape In matlab
The desired result is not obvious. Simply repeating with repmat will not work because both data set lengths are not integral di...

4 years ago | 0

| accepted

Answered
Creating a smooth phase diagram
Again just guessing here, since I have no idea what you¹re actually doing. I would still interpolate to a finer grid, and the...

4 years ago | 0

Answered
I need to filter this vector to pick out any numbers bigger than or equal to the threshold and put them into a new vector to be averaged
Try this — avgsound = mean(sounds(sounds >= threshold)); count = nnz(sounds >= threshold); .

4 years ago | 0

Answered
Iteration limit exceeded - nlinfit for non-linear regression
I used fitnlm here instead, since it outputs all the statistics as well as the parameter estimated. (It calls nlinfit so is ess...

4 years ago | 0

Load more