Answered
How to design a robust PI controller based on the Sensitivity peak value
Nowhere have you defined a variable named alpha, so when MATLAB sees alpha in your code it calls the alpha function with one out...

2 years ago | 1

Answered
understand if the cell is composed of all null elements
MATLAB is returning the correct result. The cell array is not empty, its size vector does not contain a 0. C = cell(1, 5) C{3}...

2 years ago | 1

| accepted

Answered
problem about precision in matlab
i am working with very small numbers near ordder 10^-20 in my calculations. in the program i wrote, matlab must calculate four n...

2 years ago | 1

Answered
"find" dont work for datetime variable ?
I suspect that find is working correctly and so is == when called on a datetime array, but == is not behaving as you expect. Let...

2 years ago | 0

Answered
Why can use this function with only on input?
b.nonSub1(a) just give one input Incorrect. As shown in the "Dot and Function Syntaxes" section on this documentation page this...

2 years ago | 0

| accepted

Answered
How can i generate .m file for a given simulink model?
Do you need to generate a MATLAB function file or do you just need to be able to simulate the model from MATLAB code? If the lat...

2 years ago | 0

Answered
How to fix table variable related error?
You expected for your table XX to contain a variable named td, but it doesn't. If you were trying to adapt another example to yo...

2 years ago | 0

Answered
Add 2 Numbers in a class
This syntax: x = Add; x.addNumbers(1,2); does not call the addNumbers method of the Add class with two inputs. It calls that ...

2 years ago | 0

Answered
3 d graph, but it's x vs. z and y vs. z
To plot along the plane of 0 in one of the coordinates, just use 0 when plotting. t = 0:720; z = zeros(size(t)); s = sind(t);...

2 years ago | 1

| accepted

Answered
Generate a matrix with alternative positive and negative values with ones
Another approach: r = 4; c = 5; A = (-1).^((1:r).' + (1:c))

2 years ago | 0

Answered
Why is my maxperf.m code not operating correctly
Move the lines where you define p and q and call maxperf out of the maxperf function. With those lines present, MATLAB will do o...

2 years ago | 0

Answered
Plot function suddenly not working (getting error: Index in position 1 is invalid. Array indices must be positive integers or logical values.) Even for MATLAB examples
The correct command to check whether or not you've created a variable named plot is the following: which -all plot You had the...

2 years ago | 1

Answered
transform an empty matrix '0x0 double' into a matrix '0x2 double'
Since a 0-by-0 array and a 0-by-2 array have the same number of elements you can reshape one into the other. A = zeros(0, 0) B...

3 years ago | 1

Answered
creating combinations for different data type
If you're using release R2023a or later use the combinations function. T = combinations([8, 20], ["Age", "Gender"])

3 years ago | 0

Answered
Weird behavior regarding pi in symbolic expressions
See the description of the flag input argument on the documentation page for the sym function. The default method to convert a n...

3 years ago | 0

Answered
Can graphs in Matlab provide a more detailed scale?
Let's look at the data you used to create your first graph as I suspect the insights we gain from that will apply to the others ...

3 years ago | 0

| accepted

Answered
unable to use statistics and machine learning toolbox block in Simulink
You're using this block. From that documentation page: "Import a trained regression object into the block by specifying the name...

3 years ago | 0

Answered
Save and close incrementing open figures
Don't use findobj. When you create a figure, store its handle. When you want to close a figure, use the stored handle. listOfFi...

3 years ago | 0

| accepted

Answered
I do not understand why code will not run when using varargin and am receiving too many inputs error.
You're calling your Newton Raphson function like: [root(j), ep(j), n(j)] = NewtonRaphson(@(x) func(x, e, l, i, w(j)),@(x) d...

3 years ago | 0

| accepted

Answered
Why are symbolic expressions not exactly symbolic?
Run that command in the Live Editor. [Note that I can get the same display running the code in MATLAB Answers: the functionality...

3 years ago | 1

| accepted

Answered
Updating States in ODE45
That documentation page refers to a different meaning of the term "event" in MATLAB, one unrelated to events in differential equ...

3 years ago | 0

| accepted

Answered
Matlab 2020b Update 6 creating dig folder
I believe this is Bug Report 2419782 which indicates it is fixed in the general release of R2022a and in updates for several oth...

3 years ago | 0

Answered
Error using cd Cannot CD to C:\Users\Product\Control\support (Name is nonexistent or not a directory).
I think, the directory path is right but still getting error. I would double check that the directory to which you're trying to...

3 years ago | 0

Answered
How can I import workspace arguments into a function without saving them?
I would like to create a function that directly uses arguments from the workspace without the need to save and reload the worksp...

3 years ago | 0

| accepted

Answered
Going back in time 1 week or a year
Subtract the appropriate calendar duration. t = datetime('today') oneWeekAgo = t - calweeks(1) oneYearAgo = t - calyears(1) ...

3 years ago | 1

Answered
What are the Pros and Cons of the RandStream Transformation Algorithms?
Here's a post from Cleve Moler's blog discussing Ziggurat. Section 9.3 of the chapter on Random Numbers in Cleve's book Numeric...

3 years ago | 0

Answered
How do I implement installation of the NI-DAQmx support package in a compiled application?
Based on this page and given what you said in your first bullet, that the support package isn't listed in Application Compiler, ...

3 years ago | 0

Answered
how can I increase the performance of this loop?
nPts = 15; a = linspace(0.1, 2.0, nPts); b = linspace(0.1, 2.0, nPts); c = linspace(0.1, 2.0, nPts); d = linspace(-0.3, 2.0,...

3 years ago | 0

| accepted

Answered
missing decima using 'datetime' function
No, there's no mistake, but there is a piece missing. Specifying the InputFormat when you construct a datetime only controls how...

3 years ago | 1

| accepted

Answered
How to plot y-axis limits and y-limitation line
If you want to ensure that MATLAB creates ticks and tick labels at particular values, I would use a combination of the xticks or...

3 years ago | 1

Load more