Answered
How to bold in a sprintf function?
You can do that in a a text call (with any text objects, such as title, xlabel, etc.), nowhere else. m = pi; b = exp(1); t...

4 years ago | 1

| accepted

Answered
How to create a vector whose elements are functions of a variable?
This term: sum(TmdFOURIER_TERM(dphi)) needs to be defined as a function with its argument in order to evaluate it. Nmmaxd ...

4 years ago | 0

| accepted

Answered
Why doesn't my figure(2) display anything?
Either re-define ‘a’ or make ‘b’ a function of ‘a’ instead of ‘x’. %problem: f(x)= -3x^4 + 10x^2 - 3 %one plot for -4 <= x...

4 years ago | 1

| accepted

Answered
How to filter a signal that just some special frequencies can be passed?
A reasonably efficient way of doing this is to use a multiband FIR filter, for example — Fs = 1000; ...

4 years ago | 0

Answered
How to read a set of numerical characters for time and date
To just get the dates and times, try something like this — timechar = {'14442940912210', '14443040912210', '14443140912210', '...

4 years ago | 0

| accepted

Answered
Index in position 2 exceeds array bounds (must not exceed 1).?
I am not certain what ‘t’ is. However it appears to be a column vector, so the second index is not appropriate for it. t =...

4 years ago | 0

Answered
How to change the scale values of Y axis in Matlab?
Perhaps — ylim([min(ylim) 10]) That keeps the current minimum and set the maximum at 10. .

4 years ago | 1

Answered
How to plot two exponential functions on Matlab?
Another approach — x = linspace(0, 10); f = @(x) exp(-(((x-2)/3).^2)/2); g = @(x) 1-exp(-(((x-2)/3).^2)); figure plot(x,...

4 years ago | 1

| accepted

Answered
I am trying to translate a find_peaks function call in python to matlab and they use a max threshold
There is no 'MaxPeakHeight' so impose the maximum condition after the findpeaks call to limit the maximum peak values considered...

4 years ago | 0

| accepted

Answered
the meaning of a sentence in command window
The message means that the genetic algorithm converged successfully. It has reached what it considers to be the global minimu...

4 years ago | 2

| accepted

Answered
LaPlace Transform with initial conditions
The procedure is not exactly straightforward, so I will demonstrate a working approach — syms s t y(t) Y(s) D1y = diff(y); ...

4 years ago | 2

| accepted

Answered
How to connect points in the scatter3 plot?
To connect only the corresponding points (without connecting any others) requires a loop — LD1 = load('V_1.mat'); V_1 = LD1.V...

4 years ago | 0

| accepted

Answered
Calculate time period of a graph signal
Use findpeaks to get the peak indices and then use the associated time vector to calculate the period. Use the envelope functio...

4 years ago | 1

| accepted

Answered
convert a time series into a real time animated plot
Try something like this — LD = load('timeseries.mat'); time2 = LD.time2; Time = time2.Time; Data = time2.Data; DataRange =...

4 years ago | 0

| accepted

Answered
'dlmread' function reads the variables as a*10^-3.
Most likely, it is assigning a common multiple to the matrix being read. format long v = logspace(-3, 3, 9)' Check to see...

4 years ago | 0

Answered
how to select an interval of certain hours each day within a larger timetable using timerange
The timerange function operates on timetable arrays, so to use it, the data must be in a timetable and the times must be durati...

4 years ago | 0

| accepted

Answered
A sinusoid has just been fed into a system.
Using phasors — syms omega sympref('AbbreviateOutput',false); % Optional omega = 2*pi*...

4 years ago | 0

| accepted

Answered
plot graph based on given values
Since they are histograms, I would do something like this — sn = sheetnames('https://www.mathworks.com/matlabcentral/answers/u...

4 years ago | 1

| accepted

Answered
Designing a discrete signal with cutoff frequencies
Similarly to the previous filter in Designing a specific low-pass discrete filter in MATLAB — Fs = 10; ...

4 years ago | 0

| accepted

Answered
Designing a specific low-pass discrete filter in MATLAB
Try this — Fs = 100; % Sampling Frequency (Hz) Fn = Fs/2; ...

4 years ago | 1

| accepted

Answered
am I correct in generating signals and fft?
The fft result should be normalised by dividing it by the number of elements in the vector: X1=fftshift(abs(fft(u,50)/numel(u)...

4 years ago | 1

| accepted

Answered
How can I only find centers of new blobs in image?
Try something like this — I1 = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/941229/image.jpeg'); I2...

4 years ago | 1

| accepted

Answered
How can I limit input into the command window?
I generally prefer to use the inputdlg fucntion, since it does not involve the Command Window. If MATLAB is writing to the Co...

4 years ago | 0

| accepted

Answered
i have 3 variables with varying date ranges, how do i condense the data so i have the same date range across all three variables?
There are likely several possible ways to solve this. Logical Indexing — DT = (datetime('2022-Jan-01') : days(7) : datetime...

4 years ago | 0

| accepted

Answered
Automatic detection of the maximum and halfmaximum in frequency domain
Since you apparently want the value of the peak and tha full-width-half-maximum (FWHM) distance value, use the findpeaks functio...

4 years ago | 0

Answered
How to load a matrix from a complicated txt file?
Try something like this — M = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/940659/Slice5mm.TXT')...

4 years ago | 0

Answered
how to shift datetime to account for daylight savings time
If you’ve not already explored it, the TimeZone property may be helpful. Also see Specify Time Zones since it appears that ‘A...

4 years ago | 0

| accepted

Answered
Same filters but using different methods give different results
‘I am getting different results when using the [b,a] filter method and [z,p,k] method.’ I am not surprised. Filters using tr...

4 years ago | 0

| accepted

Answered
I have created a code to graph a function, but I want to repeat 10 times that signal every 3 sec in time in the graph, so it looks like a periodic signal, any ideas how?
I do not understand the units if ‘t’ so I have no idea how this corresponds to the ‘10 times every 3 sec’ requirement. I will d...

4 years ago | 0

| accepted

Answered
Fourier transform to reciprocal space vs. time-frequency transform
There appears to be a very high D-C (constant offset) component. That is equivalent to the mean of the signal, so subtracting i...

4 years ago | 0

Load more