Answered
Converting dates in time series
One approach — M = {'27-Feb-2007 12:00:00' 58.199 -136.64 -0.0048352 ...

4 years ago | 0

Answered
Error when creating an empty Table
To preallocate a table see the documentation section on Specify Size and Variable Types since an empty table nevertheless has sp...

4 years ago | 0

| accepted

Answered
How can I split measured data in separate vectors, depending on sign value?
One approach — v= [1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1]; dv = gradient(v); sel = v(dv>=0); dsel = diff([1 find(diff([sel(1) s...

4 years ago | 0

| accepted

Answered
how to plot sequare wave ?
See if the pulstran function will do what you want.

4 years ago | 0

Answered
Fourier transform of a function
The only problem I see is in the ‘Fv’ calculation. It should be: Fv = linspace(0, 1, (nfft/2)+1)*Fn; % Frequenc...

4 years ago | 0

| accepted

Answered
Create a specific matrix (MATLAB)
Try this — M = hankel(1:4,4:-1:1) .

4 years ago | 1

| accepted

Answered
How to plot the normalized frequency spectrum of a half-wave rectified signal
Try this — T = 4; t = linspace(0,10,200); w = 2*pi/T; x = sin(w*t); x(x<0) = 0; plot(t,x); title("Señal rectificada ...

4 years ago | 0

| accepted

Answered
How to perform summation with double subscript notation?
First, provide the ‘C’ and the other missing vectors, then save ‘alpha’ as a matrix, then use the sum function to sum its elemen...

4 years ago | 0

| accepted

Answered
Unable to find symbolic solution warning
The plot shows nothing because the initial conditions are zero, and since the variables appear in both the numerator and denomin...

4 years ago | 1

Answered
How to generate a curve describing a contour on 3D scatter plot
I’m not certain what you want to do, however it is possible (although not straightforward) to extract the various contours using...

4 years ago | 0

Answered
pid controller (m-file ) with input data and output data
See if the lsim function will do what you want.

4 years ago | 0

| accepted

Answered
Categorizing groups of data
See if the findgroups function will do what you want. EDIT — (5 Mar 2022 at 17:36) Uz = unzip('https://www.mathworks.com/...

4 years ago | 0

| accepted

Answered
Decimation/Interpolation - Anti-Aliasing and Anti-imaging Filter Design in MATLAB
All this is already implemented in the resample function. Have you experimented with it, or do you simply want to reproduce i...

4 years ago | 0

Answered
Trying to change the amount of decimal points
Probably the easiest is to use the round function: weightArray=[68.6611,8.7929,71.6766,44.1901,76.2861,66.1515,22.6083,36.9491...

4 years ago | 0

Answered
How do I interpolate to get the y axis values when I sub in the x axis values? My data is like a plot with no function associated to it.
After first creating ‘FinalList’ as a table and writing it to a file: FinalList = array2table(final_list_2_5, 'VariableNames'...

4 years ago | 0

| accepted

Answered
Model producing negative values where it shouldn't
The exp calls are multiplied by ‘-i0_a’ or ‘-i0_c’ in the posted code. %Anode i_a = (-i0_a) * exp(a_anode*F*(Ea-Er_a)/(R*T))...

4 years ago | 0

| accepted

Answered
How to insert a variable and datetime array into a graph title?
It would be easier to use datetime than earlier date versions — N = 4; for k = 1:N subplot(2,2,k) plot((1:5), randn...

4 years ago | 0

| accepted

Answered
Power series with array input
I am not certain what the desired final result is, or what the function does. If ‘n’ and ‘r’ are row vectors (and by definiti...

4 years ago | 0

Answered
Sum elements in the first column according to repeated values in a second column
A = [ 4 55 3 55 7 55 1 55 9 98 1 98 2 98 8 98 0 98 1 98 ...

4 years ago | 1

| accepted

Answered
How to make MATLAB compute values in vertical columns to copy easier?
Using the ‘(:)’ subscript convention, each variable will be forced to be a column vector regardless of its original orientation:...

4 years ago | 0

| accepted

Answered
How to factorise functions of order 4 in matlab
See if the zpk function will do what you want. (It will factor both the numeriator and denominator.)

4 years ago | 0

| accepted

Answered
Error with Invalid indexing in system of differential equations
Remove the ‘(t)’ in the dsolve output and the error disappears. However, the system is nonlinear, so an analytic solution likel...

4 years ago | 0

| accepted

Answered
I am trying to find the rms of data points . I got x.y,z coordinates . I have tried to use the rms(M*N) function in the program but it didnt work. any suggestions is welcomed
I am not certain what is. If it is indeed a function, then the function needs to be described mathematically in order to do th...

4 years ago | 1

Answered
plot repeated rect function
The pulsetran function is one option. Another is the stairs function. There are other possibilities as well. .

4 years ago | 0

| accepted

Answered
How to format time with fprintf
Try this — date_1 = datetime('now'); for k = 1:1E+8 rand; end date_2 = datetime('now'); Elapsed_time = date_2 - date_...

4 years ago | 2

| accepted

Answered
Array indices must be positive integers or logical values.
Try this — iv = 1:dt:tEmpty; for i = 1:numel(iv) heightArray(1,i) = sqrt(h1) - (.5 * k .* timesArray(i))^2; flowRate...

4 years ago | 1

| accepted

Answered
Line of best fit not plotting correctly
Try this — plot(E5half41, y) The independent variable is the first argument. I cannot run the code without the data, howev...

4 years ago | 0

| accepted

Answered
For Loop Graph Not Plotting
I could be missing something, however, how could this: if (theta <= 0) & (theta >= pi/2) ever be true? It would likely w...

4 years ago | 0

| accepted

Answered
What general integration method does the "lsim" function use? As in: Modified Euler..or Runge_Kutta.. or Adams-Bashforth?
I do not believe it does either one. See Algorithms for details.

4 years ago | 0

Answered
How do I get time-domain data for Control System Internal AnalysisPoints
Likely the best you can do with lsim are to get the state trajectories. See Get state update for simulation of discrete state s...

4 years ago | 0

Load more