Respondida
The code runs when if I do; newton_recur(@(x) x^2,@(x) 2*x,1,10) but wont work if I leave out the @(x). is there a way to do this so that the user doesn't need to add @(x)?
You mean you want the user to enter 'x^2' and '2*x' and automatically generate the anonymous functions? Take a look at the vecto...

más de 2 años hace | 0

Respondida
How to Convert data from HEX codes to Numeric
Do you mean you have the hex representation of a double precision number and want to convert it into the corresponding double? S...

más de 2 años hace | 0

Respondida
How to count the occurrence of numbers in certain value range (show 0 if no occurrence)
If your data is sorted you could use histcounts. In the case of your sample data, where all the values are integers, I'm going t...

más de 2 años hace | 1

Respondida
Matlab generate normal random sample with outliers
warning('off','all') Seeing this in the code smells bad. If you want to select a different element each iteration (and have en...

más de 2 años hace | 1

| aceptada

Respondida
Using repelem to vertially concatonate non-numeric variable
Note that the for loop approach from @Atsushi Ueno works if the "pieces" of the names are the same length all the way down the l...

más de 2 años hace | 0

Respondida
i want to find k for different values of w using determinants, after that i want to find y2 for the different values but y2 cannot be executed
w is a vector. w=1:3 y1(j) is a scalar. For purposes of this example I'll show a "dummy" y1 vector. y1 = [4 5 6]; j = 1; y1...

más de 2 años hace | 0

| aceptada

Respondida
How do i fix my newtons method code?
There is one obvious syntax error, one functionality error, and one change I strongly recommend. Recommended change On the lin...

más de 2 años hace | 2

Respondida
How to change a parameter of an objective function during optimization of simulated annealing ?
Now, my objective function has an extra parameter, in addition to the independent variables, which is a variable that I want to ...

más de 2 años hace | 0

Respondida
Error with fmincon Unable to resolve the name 'optim.coder.validate.checkProducts'.
What does this command show? which -all fmincon And do you have MATLAB Coder installed? I suspect the answers to those two que...

más de 2 años hace | 0

Respondida
How to center the bars of the histogram over the elements of the input array?
thanks a lot @Star Strider, but why do we get frequency = 5 for x = 4 ? Shouldn't it be frequency = 2 for x = 4? BinWidth and ...

más de 2 años hace | 2

| aceptada

Respondida
Inverse Matrix for 6x6 matrix with variables
The symvar function does not define symbolic variables. It identifies identifiers in an expression (other than those in a small ...

más de 2 años hace | 0

Respondida
Error Not same Vector length why not functioning
Just as a guess, did you expect this to create a 20 element vector whose first element is 0 and whose last is 2001? t1 = linspa...

más de 2 años hace | 0

| aceptada

Respondida
How to know exactly what row (or index number?) in a table based on user input?
If you had a timetable array, you could either use the == operator as others have suggested or create a timerange (if you need t...

más de 2 años hace | 0

Respondida
problem axis "x" in my graph
Those seem reasonable to me. They're showing the month and date along with the time of data for each of your X coordinates. I su...

más de 2 años hace | 0

Respondida
Help with axes labels on histogram plot
If you want the labels to be only in the center of the bars, use the BinEdges property of the histogram to compute where the tic...

más de 2 años hace | 0

Respondida
Problem to call fitcecoc with Matlab runtime
If you are attempting to compile code using MATLAB Compiler that calls load to load an object from a MAT-file and there is no in...

más de 2 años hace | 0

Respondida
MATLAB built-in examples not opening and giving error
According to the Release Notes for Simscape Electrical, the names of the example models and/or the way you access them changed i...

más de 2 años hace | 1

| aceptada

Respondida
Load data and store in workspace in individual variables
Can you dynamically create variables with numbered names like x1, x2, x3, etc.? Yes. Should you do this? The general consensus ...

más de 2 años hace | 0

Respondida
"Invalid use of operator." doesn't go even after trying various solutions :(
That doesn't match any of the allowed syntaxes shown on the for keyword documentation page. If you want the code to run only if...

más de 2 años hace | 0

Respondida
Error using sym/subs Too many input arguments. Error in mx_model (line 176) f = subs(f, cup,cu,0);
In the past the subs function for symbolic expressions did accept four inputs. The last input controlled whether or not we tried...

más de 2 años hace | 1

Respondida
Error Saving figure: Error using sprintf: Conversion to text from matlab.ui.Figure is not possible.
Your full error message references line 63 in the savefig function, which in the savefig function included in MATLAB: which -al...

más de 2 años hace | 3

| aceptada

Respondida
while closing the GUI in MATLAB 23a give following error
You could wrap that set call in a try / catch block and check if the handle to the text box isvalid in the catch block. If it is...

más de 2 años hace | 1

| aceptada

Respondida
How to build polynomial with cscvn function coeffs?
If you want to evaluate the spline, don't try to make polynomials. Just use the output argument from your call to cscvn with the...

casi 3 años hace | 0

Respondida
Array indices must be positive integers or logical values.
Did you mean r*(1-tau) instead of r(1-tau) in the command in the innermost for loop?

casi 3 años hace | 0

| aceptada

Respondida
External Users Viewing Fig file
No, as far as I'm aware there is no stand-alone viewer for .fig files. One approach you could use to allow your users without MA...

casi 3 años hace | 0

Respondida
generate all possible upper triangular matricies with variables
Since you're using release R2023b, you can use the combinations function introduced in release R2023a. values = [0, 1, 2]; g =...

casi 3 años hace | 0

Respondida
Subs does not calculate result
If you want to see or obtain the floating point approximation to the symbolic answer, use the double or vpa functions or change ...

casi 3 años hace | 0

Respondida
Extract time (hour+minute+second) from datetime vector
If you can use a datetime array instead of serial date numbers (or convert the serial date numbers to datetime): rightnow = dat...

casi 3 años hace | 0

Respondida
use fmincon with 0<x1<x2<x3
Another possible solution is to redefine your code in terms of d(1), d(2), d(3), etc. Constrain all the elements of the d vector...

casi 3 años hace | 0

Respondida
Math operations with Double or Uint8
What is the range of numbers you can store in an uint8 array? [intmin('uint8'), intmax('uint8')] If the results of computation...

casi 3 años hace | 1

| aceptada

Cargar más