Answered
I want to find the least negative non positive number in a vector
Perhaps this — V = [-10 , -5 , -1 , -0.1 , 0 , 1 , 2 , 3 , 4 , 5] [Vmax,idx] = max(V(V<0)) V(idx) .

2 months ago | 1

| accepted

Answered
Plot Piecewise function graph
To do this in the Symbolic Math Toolbox, just write it essentially as in your original post — syms x f(x) = piecewise((-3*...

2 months ago | 0

Answered
Surf plot from excel file
It would help to know what the data are, and what you want to do with the NaN values. That aside, just plot all but the firs...

2 months ago | 0

Answered
How to Curvefit amplitude output of a spring-mass-damper system to find coefficients?
Try this — load('sampleData.mat') % whos objfcn = @(b,t) b(1) .* exp(b(2).*t) .* cos(2*pi*b(3)*t + b(4)) + b(5); Lvlm =...

2 months ago | 0

| accepted

Answered
Using string variable names for dot indexing
That approach can work, however it is necessary to put the variable name from the cell array in parentheses — varnames = {'rs...

2 months ago | 0

| accepted

Answered
Normalized graph not showing
The timeseries ‘out.Q_i_nd.Data’ is a 3D matrix. You need to use the squeeze function to remove the extra singleton dimensions. ...

2 months ago | 0

Answered
Want to truncate an array
There are a few options, including using the vpa function in the Symbolic Math Toolbox, and to use sprintf to display the values...

2 months ago | 0

Answered
bug in sprintf 2024a, can't use other variable and just repeating the first variable
The residue funciton produces column vectors in its output. To use sprintf with them, concatenate them in a matrix and then tra...

2 months ago | 0

| accepted

Answered
Graph lines not showing
See if the yline function will do what you want.

2 months ago | 1

Answered
Two sets of data with two date ranges and y-axis values
Try this — x1 = 1:250; y1 = 20*sin(2*pi*x1/100) + 20 + randn(size(x1))*5; x2 = 15:250; y2 = cos(2*pi*x2/150)*60 + 150 + ...

2 months ago | 1

| accepted

Answered
Parameters identification providing derivative
The differential equation needs to be integrated in order to use . This does not appear to be as straightforward as I would hav...

2 months ago | 1

| accepted

Answered
How to use values from excel file in genetic algorithm
Use the readmatrix function instead of readtable since there are no variable names. It produces a matrix that can be address...

2 months ago | 1

| accepted

Answered
How to do fft of a csv file to plot amplitude spectrum
See the documentation for both fft and nufft. One of those should apply to your problem. Another optioon is the pspectrum fu...

2 months ago | 0

Answered
Parameter estimation of SEIHRDBP model
The time values are incorrect. The complete table of those values should be — Date Infected Death ____ ___...

2 months ago | 0

| accepted

Answered
Fitting an custom equasion where i only want to optimize specific parameters
You would need to supply pre-determined values for ‘sigk’, ‘h1’, ‘g1’, and ‘Dwir’ if you have them (you have already calculated ...

2 months ago | 1

Answered
Grid in MIMO nyquist diagram
I am not certain what you want to do or how much of the documentation you have explored. Most of the Control System Toolbox a...

2 months ago | 1

Answered
Fittype issue: unrealistic results and problems with upper and lower bounds
The bounds may not be set correctly. Note that while ‘a’ is supposed to be between 0.1 and 1, your bounds for it are between 10...

2 months ago | 0

| accepted

Answered
Parameter estimation of SEIHRDBP model
Thank you for quoting my code! The problem was here: c0=theta(end-3:end); use this instead: c0=theta(end-7:end); Since m...

2 months ago | 0

| accepted

Answered
unable to plot semilogy properly
The easiest way to solve that is to plot each curve on its own y-axis using the yyaxis function — % QPSK M = 8; k = log2(M)...

2 months ago | 0

| accepted

Answered
datetime don't displays the correct order
The 'InputFormat' and 'Format' name-value pairs are not the same. You need to specify them separately — aaa=datetime(dataa,...

2 months ago | 0

| accepted

Answered
How to get daily max, min, and mean from a timetable?
Your groupsummary call is correct, except for not putting the data variables in square brackets (or curly braces). With that...

2 months ago | 0

| accepted

Answered
I'm unsure of why there is an error on F=@x
The statement order is reversed from what it should be — f=@(x)exp(-0.5*x)*(4-x)-2; df=@(x)exp(-0.5*x)*(-3+0.5*x); Xs = n...

2 months ago | 1

| accepted

Answered
small floating point has been considred as zero value!
Your code works correctly when I run it here — x=0.16 if x>0.1 d=1 else d=0 end d .

2 months ago | 0

Answered
Find Area under the curve as a non negative
It would help to have the data. Perhaps selecting everything with both x and y coordinates greater than zero, and then integr...

2 months ago | 0

| accepted

Answered
Transparency in scatter plot
It would help to have representative data. I suspect the vector you are using as ‘C’ has very low positive values (perhaps on ...

2 months ago | 0

Answered
readtable() ignores variable names and loses data when "extra" cells contain values
‘How can I tell readtable() to ignore any extraneous cells to the right of the main data that starts in A1?’ Without a file t...

2 months ago | 1

Answered
Importing data from outside matlab directory?
Probably the easiest way is to use the fullfile function to generate the complete path to the file. To access other files in th...

2 months ago | 0

Answered
Acceleration of code by replacing two nested for-loops
This could be difficult with your code because of the multidimensional nature of ‘B’, however the usual approach is to create m...

2 months ago | 0

Answered
Viewing a house in MATLAB
The walls and roof needed duplicates with some offsets to plot correctly. Other than that, the patch arguments are set up to be...

2 months ago | 0

| accepted

Load more