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

Answered
Signal amplitude decreases after FIR filter(windowing method)
I have no idea what the sampling frequency is, so I assume 10 GHz here, with a cutoff of 1.5 GHz. When I simulate it with the f...

4 years ago | 1

Answered
What is wrong with my Code? (Fast Fourier Transform)
The ‘rect’ funciton does not exist in MATLAB, so I use rectpuls here instead — %A1.2 T = 0.002; t = -0.01 : 0.0002 : 0.01; ...

4 years ago | 1

| accepted

Answered
why sos doesn't have overshoot
The transfer function representation is unstable. The second-order-section representation creates a stable filter. That is evi...

4 years ago | 0

| accepted

Answered
Combining two datetime columns into one
Another option is to use timeofday — Date = repmat(datetime('now','Format','MM/dd/yyyy'), 3, 1); Time = datetime('now','Forma...

4 years ago | 0

| accepted

Answered
Matlab returns answer with another variable z. What does this mean?
Put the syms declaration first and use vpasolve — syms gamma Usb A2a U2a U2b R = 8; gamma = 1.4; U2b = 1000; U2a = 800; T...

4 years ago | 0

Answered
Change detection (step) in timeseries signal
You can likely get close to that point using islocalmax and particularly Flat Maxima Regions. It might be necessary to use smoo...

4 years ago | 0

| accepted

Answered
Extract the last day of each month in daily data set
One approach — T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/918889/VIX.csv', 'VariableNaming...

4 years ago | 0

| accepted

Answered
Same colour scale for scatter and line plots on same graph - different groups of data
For 1. this is easy enough Use plot instead of scatter — powerpc=[70 58 42 28]; figure %subplot(4,2,8); plot...

4 years ago | 0

| accepted

Answered
Help regarding plotting of graphs
With those ranges and magnitudes, the logspace funciton would be the better option — t = logspace(1, 99, 1000); y = exp(-1E-4...

4 years ago | 0

| accepted

Answered
looking for values for all days but only for a certain time range
Use ‘logical indexing’ (the ‘Nighttime’ vector here) to choose the time range — Timestamps = datetime('07-Mar-2022 10:44:37','...

4 years ago | 0

| accepted

Answered
How to insert an image into an image in matlab ?
The Position Multiple Axes in Figure documentation section in axes could work here — Ic = imread('cameraman.tif'); Ip = imre...

4 years ago | 1

Answered
I am not understanding why my code is giving me a not enough input error.
I’m not certain how you called the function. This lacks the file, although it otherwise appears to work — peak_hour = 12; ...

4 years ago | 0

Answered
Accidentally edited .m file
If you did not close MATLAB after the unfortunate edit, it might be possible to reverse the edits by using the ‘undo' arrow (cou...

4 years ago | 0

| accepted

Answered
new column with running average of existing column
Try this — T1 = table(randn(20,1)) T1.Var2 = movmean(T1.Var1,[10 10]) See the documentation on movmean for details. .

4 years ago | 0

| accepted

Answered
How to fprintf a 1 column matrix of random length
Try this — v = [10.5000 18.0000 16.5000 21.0000]; L = 1:numel(v); fprintf('Row %3d is %g\n',[L(:) v].') ...

4 years ago | 1

| accepted

Answered
Interpolation not-equally spacing data
I generally use griddata for these sorts of problems. I cannot determine if it will produce the desired result since I don’t ...

4 years ago | 0

Load more