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

Answered
Decimail Years date to JulianDate
Try this — format long g T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/908805/exp.txt', 'Var...

4 years ago | 1

| accepted

Answered
Difference between bode and my calculation of amplitude of the frequency response
The ‘fre’ vector needs to be created in logspace and it then needs to be divided by because the frequency axis is in rad/sec. ...

4 years ago | 0

| accepted

Answered
How to index a cell array in a for loop
See if: base_obs{i} = cell2mat(textscan(fileID, '%f %f %f %f %f %f %f %f')); produces the desired result. .

4 years ago | 1

Answered
Can't write transfer function properly.
MATLAB does not recognise implicit multiplication. Be sure to include multiplication operators (*) when you code ‘G’ just aft...

4 years ago | 0

| accepted

Answered
Exponential Function Plotting From Reverse
I initially could not get the 'XDir' to 'reverse' before the loop. Apparently it is necessary to plot something and then set th...

4 years ago | 0

| accepted

Answered
draw a function composed of sin and cos
Use element-wise operations y1=100*sqrt(2*pi)/sqrt(0.05*pi).*cos(x/2).*(1.-cos(x/2.).*sin(x/2.).*sin(3.*x/2.)); ...

4 years ago | 0

| accepted

Answered
Highlighting sections of a plot
The patch function did not always work with datetime values. It does in recent releases. However it does not appear that the...

4 years ago | 1

| accepted

Answered
How to add a patch to a plot of data?
I am not certain what your function or data are or what you want to plot. See if this helps to cliarify the general approach ...

4 years ago | 0

Answered
How to fine a range of values before and after a specific value with a condition
Try this — GetRange = @(range,Val,T,Col) strfind(T{:,Col}', [zeros(1,range) Val zeros(1,range)]); Col2 = zeros(24,1); Col2(r...

4 years ago | 0

| accepted

Answered
add vertical lines using xline
It would helpo to understand what the dates are in the posted code. figure xline(datetime('20/01 7:00am', 'InputFormat','dd/...

4 years ago | 0

| accepted

Answered
Get state update for simulation of discrete state space system using lsim().
One problem is that the code ‘mixes apples and oranges’. The tf2ss function is a Signal Processing Toolbox function, as is butt...

4 years ago | 0

| accepted

Answered
Best matlab package for time series modelling
The arima function exists in the Econometrics Toolbox. (I do not have it and so I have no experience with it.) Perhaps that wo...

4 years ago | 0

| accepted

Answered
Extracting individual breathing cycles from a signal and plotting the mean cycle
If the peaks define the cycle, then finding the ‘valleys’ between them will define the beginning and end points of each cycle. ...

4 years ago | 1

Answered
state-space controlability
The example in the documentation section on Check System Controllability is the same test I usually use. It would be appropriat...

4 years ago | 0

| accepted

Load more