Answered
How to generate matrix in MATLAB
Try this — N = 32; C = 33; Wc = exp((1j*2*pi)/C) P = ones(N+1,C); P(2:end,2:end) = Wc.^((1:N)'*(1:C-1)) The approach ...

2 years ago | 0

| accepted

Answered
what is wrong with my FFT from a Shaker with accelerometer mounted
I compared your fft code with my stock fft code and got the same result. I believe that the problem is the sampling frequency...

2 years ago | 0

Answered
how to assign a numerical value to an image based on the gray scale present in the image
I am not certain what you want, however the imhist function may help calculate it. This approach does a simple linear regress...

2 years ago | 0

Answered
How to color or patch the region between a curve and the x axis
I posted this in response to your Comment (I’ve since deleted my responding Comment), so I’m now posting it as an Answer here — ...

2 years ago | 0

| accepted

Answered
spectrogram unit change from dB/Hz to linear scale
If you want dB rather than dB/Hz, use the pspectrum function with the 'spectrogram' option argument. To get magnitude from dB...

2 years ago | 0

Answered
Why doesn't timezone work with datetime
The timezone function is from the Mapping Toolbox, and its results are not compatible with the datetime function. The otherwise...

2 years ago | 1

| accepted

Answered
Why damping amplitude the amplitude shifting position of y azis
It would help to have the file to demonstrate with it, however that may not be absolutely necessary. The signal in the file (...

2 years ago | 0

| accepted

Answered
Evaluating a complex equation
Preallocate ‘Y’ as: Y=zeros(8,numel(t)); add a second dimension to ‘Y’ in the assignment to it: Y(n,:) = ... and add ‘t’ t...

2 years ago | 0

| accepted

Answered
Why low pass filtering requires long duration time signals?
1. The problem with needing long signals is primarily due to using an FIR filter, since FIR filters are usually long in order t...

2 years ago | 0

Answered
Concatenating Arrays end to end 1D
One option is to convert ‘Duplicates’ to a cell array (using num2cell) to make it compatible with the other values — Blank='-'...

2 years ago | 0

| accepted

Answered
wny fft does't work with different signal?
Thbere is a farily significant D-C or constant offset in ‘data(:,2)’ and that hides all the spectral peaks of lower magnitudes. ...

2 years ago | 0

| accepted

Answered
How to find the intersection values of line and curve?
Try this — % clc % close all d1 = 0.4;d2 = 0.6;d = d1 + d2; n1 = 3.46;n2 = 1.5; lambda = linspace(400e-3,800e-3, 100000)...

2 years ago | 0

| accepted

Answered
color map with specific range
I used 'filled' here because otherwise the yellow points may be difficult to see — figure imshow(imread('tri.jpg')) x = 1:...

2 years ago | 1

Answered
look up data from table (either from excel, table in matlab, or text fil) using App Developer
Another option for the lookup — Table = readtable('FluxDataInterpolated.xlsx'); inclination = Table{1,2:end}; altitude = Tab...

2 years ago | 0

Answered
The least square with changing number of lines of matrix
I am not certain what you want. This calculates regressions on each column of ‘y’ and then plots it in the same colours as th...

2 years ago | 0

Answered
Create a 3D plot with shadow length, altitude, and time.
Filling the inside of the 3D curve is straightforrward — run('shadecode.mlx') T1 = readtable('Shadedata.xlsx') t = T1.Time...

2 years ago | 0

| accepted

Answered
Failure on combining 2 timetable
Experiment with the synchronize function to see if it will do what you want. EDIT — (21 Aug 2023 at 15:57) To illustrate —...

2 years ago | 0

| accepted

Answered
System response from input and output signals
First, use the System Identification Toolbox (iddata then ssest and compare then lsim) or the Signal Processing Toolbox (invfreq...

2 years ago | 0

| accepted

Answered
How to create nested legend
One option is to put each ‘h’ in a separate column — h = 300 : 75 : 525; w = 60 : 30 : 180; [H,W] = ndgrid(h,w); figure...

2 years ago | 0

| accepted

Answered
Averaging data from seconds to three seconds because of different time variables
I am not certain that it is possible, however if it is, some combination of retime and synchronize could work. EDIT — (21 A...

2 years ago | 1

Answered
How to make contour smooth
There are a few options, one being to plot fewer levels, and the second being to downsample the matrix using interp2 and also ch...

2 years ago | 0

| accepted

Answered
Matlab figure: Replace xaxis with custom labels
Another approach — sun = sin((0:240)*pi/25).^2 .* exp(-0.015*(0:240)); figure plot(sun) figure plot(sun) xt = xticks;...

2 years ago | 0

Answered
Interpolation using Excel Data
One approach — % C1 = readcell('FluxData.xlsx') T1 = readtable('FluxData.xlsx') xvar = T1{1,3:end}; yvar = T1{2:end,2}; ...

2 years ago | 0

| accepted

Answered
Read excel file with Matlab
One option is to use the datetime 'ConvertFrom' name-value pair. For the ‘value’ argument, both 'excel' and 'posixtime' work, ...

2 years ago | 0

| accepted

Answered
I hava wav file and need to plot spectrogram in matlab
The argument to spectrogram must be a vector. I suspect the error is that ‘y’ is a (Nx2) matrix, and that is throwing the error...

2 years ago | 0

Answered
Nonlinear Regression using a gaussian in a lattice
One approach (using smaller matrices for efficiency and to demonstrate and test the code) — syms a sigma dr = sym('dr',[3 3]...

2 years ago | 0

| accepted

Answered
Why is NaN inserted in wrong position?
It should not do anything, because 5 is in row 2, not row 1. That aside, you need to index into ‘b’ correctly to get the desi...

2 years ago | 1

| accepted

Answered
passing filenames to a dos command
See if the system function will do what you want. Also, see Run External Commands, Scripts, and Programs for a more extensive...

2 years ago | 0

Answered
how can I plot the contours inside not outside?
What result do you want? Try this — figure F = openfig('untitled.fig'); Lines = findobj(F, 'Type','line'); for k = 1:nume...

2 years ago | 0

Answered
how to include symbol on plot line into the legend?
The code plots two lines, however has only one legend entry, so the second series (with the '<' marker) does not show up in the ...

2 years ago | 0

Load more