Answered
how i can have gradient of a multivariate function like f(x,y) in a single function?
If you want this for a specific function you can just create the function directly: >> g = @(x,y) [2*x,2*y]; >> g(1,1) ...

10 years ago | 0

| accepted

Answered
How to calculate mean, standard deviation?
You can index a table by the VariableNames. Furthermore we can use the properties of logs: log(a/b) = log(a) - log(b). This will...

10 years ago | 3

| accepted

Answered
Use a variable in Request user input prompt.
The identifier you are using in _sprintf_ (_%f_) stands for floating point, but you want a char array so use the identifier _%s_...

10 years ago | 2

| accepted

Answered
for to parfor, Error: The variable h in a parfor cannot be classified.
You cannot assign to an index which depends on another variable inside a parfor loop. Instead you can assign to a temporary vari...

10 years ago | 1

Answered
How to display all this in a single msgbox?
You can use _sprintf_ to make these each into char arrays and place them into a cell array. Here's an example x = 12; ms...

10 years ago | 1

| accepted

Answered
nancov gives strange results
When you use _nanstd_ each standard deviation is calculated only using the data for that column, so _nanstd_ can ignore all NaN ...

10 years ago | 1

| accepted

Answered
Not enough input arguments in embedded function when using fsolve!
First off your function to be evaluated should accept only a vector as input. I notice you are providing an initial point: ...

10 years ago | 0

| accepted

Answered
Problem with Portfolio Optimization, Mean Returns are not processed as vectors
The problem is likely due to the presence of all NaNs in one of your return series, which results in a NaN even using _nanmean_....

10 years ago | 1

| accepted

Answered
cond() for sparse matrices
I would assume that the why has to do with the simplicity with which one can calculate the 1-norm of a sparse matrix. Both _cond...

10 years ago | 0

| accepted

Answered
Using bndyield can "yield" complex roots.
The only reason that I could see this happening is if your Price of the bond is negative and your coupons are positive. Is there...

10 years ago | 0

Answered
find line handles related to legend entries
The legend will no longer store this information unless you pass it to the UserData. I would suggest returning the objects creat...

10 years ago | 0

Answered
How to calculate overlapping area of two cdf's?
You could approach this with a Riemann sum or trapezoid rule, but to do this you would want to analyze the density at the same p...

10 years ago | 0

Answered
Remove diagnostic information, iterations, estimate results..from screen from egarch fit
The documentation you will find online is always for the latest release of MATLAB. You are likely using a release prior which di...

10 years ago | 0

| accepted

Answered
Exponentiation of Matrix Columns by different Powers
_repmat_ can be used to create a matrix bExp of the same size as A where the rows are repeated. bExp = repmat(b,size(A,1),1...

10 years ago | 0

| accepted

Answered
assigning to object variables from within-object functions
If you want to have your original object updated you should make your class a handle class: classdef myClass < handle ...

10 years ago | 2

Answered
Issue with fprint() on a (2*3) matrix
MATLAB is a column major language, so when it reads in elements of A it reads in order A(1,1), A(2,1),...A(end,1),A(2,1),A(2,2),...

10 years ago | 0

Answered
Is there a way to manipulate the Font that is displayed in the Command Window?
In MATLAB under the HOME tab, select preferences -> Fonts This will give you the option you need.

10 years ago | 1

| accepted

Answered
In parfor , why a variable cannot be classified?
Preallocate your matrix before the loop: Matrix = nan(n,9) Although lookingat your catch statement is Matrix a cell arra...

10 years ago | 0

Answered
how Matlab iqr works
MATLAB uses the prctile() function to find Q3 and Q1 to calculate the IQR. See <http://www.mathworks.com/help/releases/R2015a/st...

10 years ago | 0

Answered
Changing the marker type for the nth entry in plot
You would have to accomplish this as a second plot, since each Line has a MarkerStyle associated with all of the data points. To...

10 years ago | 0

| accepted

Answered
How can I extract data from table keeping while keeping the floating point?
The only reason this would happen is if at least one of the columns is of class uint*, where * could be 8, 16, etc.. The issue i...

10 years ago | 0

| accepted

Answered
index out of bounds error
You are using the find function and then assigning values based on that to the variable _Xidx2{kidx}_. If you use the debugger w...

10 years ago | 0

| accepted

Answered
Parfor: Variable (Ind) is not sliced; Recommendations about my code?
Often times when you run into an error like this, your easiest solution will be to take the inside of the parfor loop and turn i...

10 years ago | 0

Answered
Create a table from symbolic vectors
The _table(var1, var2,...)_ function will create a table where the variables are the inputs _var1_, _var2_, ... What you want...

10 years ago | 0

Answered
undefine function or variable
Judging by what you have written and the error given it seems that your issue is with the capitalization. MATLAB is case sensiti...

10 years ago | 0

| accepted

Answered
How do I delete the rows in amtrix wherre one column is less than another.
To delete the rows of *A* where the fourth column is not the largest value in that row, we just need to perform a logical compar...

10 years ago | 1

Answered
How to change color in a plot?
One thing you could do is just change the ColorOrder property of the axes itself: f = figure; colors = [0 0 0.7; 0.7 0 0...

10 years ago | 5

Answered
What is causing the error from matlab predict function? Also, how to format data to use in classifier validation?
Given the error it seems that maybe your data contains values which are not doubles (i.e. integers) which need to first be cast ...

10 years ago | 0

Answered
How to reduce execution time of a code in matlab R2013a
To reduce execution time, run the code in the Profiler. <http://www.mathworks.com/help/releases/R2015a/matlab/matlab_prog/pro...

10 years ago | 2

Answered
How to implement AR and ARMA model in data
Yes. This would be the function *arima* in the _Econometrics Toolbox_. We also have a course <http://www.mathworks.com/services/...

10 years ago | 0

| accepted

Load more