Answered
Fsolve with constraint for positivity
You have a system of 5 linear equations, in 5 unknowns. As long as the system is non-singular, there is only ONE solution. Using...

8 years ago | 1

| accepted

Answered
I would like to know how to implement a bivariate normal distribution.
Using the stats toolbox, you want to use mvncdf, not mvnpdf anyway. (Ok, you could integrate the pdf. But why would you here?) ...

8 years ago | 1

Answered
how to fix the error?
Why do you think that 0.4 is correct? The first mile is $2.00. If age is less than or equal to 18 (or at least 60), then the ...

8 years ago | 1

Answered
Strange results for evaluating quadratic function on a linspace
Can you represent the number 1/3 EXACTLY as a decimal (thus base 10) number in a finite number of decimal digits? (Hint: NO) ...

8 years ago | 0

| accepted

Answered
What is the best method to generate function handle from double array?
Integral is not designed to integrate a list of data points such as you have. Worse, all you are doing is creating a piecewise l...

8 years ago | 0

| accepted

Answered
Interpolate non monotonic and repetitive sperimental data
This is not a question about interpolation. Why not? What is interpolation? It involves finding a curve that passes EXACTLY t...

8 years ago | 0

| accepted

Answered
How to get R^2 of a 5th order polyfit?
polyfit does not return an R^2. A good idea, because IMHO, R^2 is of little value in determining if the fit is good. Does the fi...

8 years ago | 3

Answered
How to plot circle by one single equation?
As one "equation" what does that mean? About the best I can offer is this: r=2; x0=0; y0=0; ezplot(@(x,y) (x-x...

8 years ago | 6

| accepted

Answered
Why is det a bad way to check matrix singularity?
The example I always like to give is this: det(3*eye(1000)) ans = Inf det(.3*eye(1000)) ans = 0 ...

8 years ago | 1

| accepted

Answered
How can I find an equation that fit a set of data?
PLOT your data. ALWAYS PLOT YOUR DATA. Do that first, before you do anything else. Then, look at your data. plot3(X,Y,F,'o'...

8 years ago | 1

Answered
problem in plotting cdf for gamma distribution
Is your data sorted in increasing order? (No, it is not.) Plot draws a line from one point to the next. But you r data is not...

8 years ago | 0

| accepted

Answered
Having trouble plotting a surface
I won't write your code for you. But I must accept that you may not know the existence of tools like fimplicit. syms x y z ...

8 years ago | 0

Answered
How to find interpolated values when there are multiple?
interp1 assumes a single valued functional relationship. You cannot use interp1 to do what you wish to do. Instead, use a too...

8 years ago | 1

| accepted

Answered
why polyfit poly roots is not equal to primitive poly roots
Because you did not use polyfit correctly. Look carefully at what you did! p_fit=polyfit(p,x,4); What are the arguments ...

8 years ago | 0

| accepted

Answered
SOlving Simultaneous Differential Equations
help ode45

8 years ago | 0

Answered
%How can i create this vector? Please I need your help.
help repelem

8 years ago | 1

Answered
How to use loop with vpasolve ??
What is the cause? READ THE ERROR MESSAGE. "Index exceeds matrix dimensions." What are you indexing? bast(i)=(r(i)/...

8 years ago | 0

Answered
[Help in Formula implementation] Why am I getting a float value when a integer value is expected?
p = 17; q = 19; n = p*q; lambda = lcm((p - 1), (q - 1)); g = n+1; a = (powermod(g, lambda, n*n) - 1) / n; ...

8 years ago | 1

| accepted

Answered
Error using ^ One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power.
Consider the matrix A = [1 2;3 4]; Suppose you wanted to multiply the matrix with itself? B = A*A; Essentially,...

8 years ago | 4

| accepted

Answered
integration of lognormal distribution does not give 1
Think about it. You are trying to integrate what is essentially a delta function, a function that is a spike, over a TINY interv...

8 years ago | 1

Answered
Function returns ans rather than actual output variables
When you call a function, ANY function, what happens? How do you use it? For example, suppose I use the function sum? What do...

8 years ago | 3

Answered
Using Polyfit to determine new X values (instead of Y)
You CANNOT simply swap x and y, and fit a new polynomial to the result, thus model the curve as x(y). Think about what that w...

8 years ago | 1

| accepted

Answered
Matlab SVD & PCA - which singular values belongs to which variables?
A singular value does NOT belong to ANY variable. There is NO correspondence, nor certainly any ownership. The sort that is d...

8 years ago | 0

Answered
Two points at a given distance in space: no solution
I'm not sure what you are trying to solve here, or why you are doing this as you are. sqrt(dot(V-W, V-W))==4 Writing thi...

8 years ago | 0

Answered
acosd returns complex number
No. Period. NO. Your problem is that you apparently don't appreciate what acosd means. Think about what acosd is supposed to ...

8 years ago | 0

Answered
How to add a small random number to all values in a matrix
Others have shown how to use RAND. RANDN is sometimes appropriate. Sometimes RAND. Some of the time you simply don't care, you j...

8 years ago | 1

Answered
Undefined function or variable 'kappa'
There is no function named kappa in MATLAB, or in any toolbox that I can find. However, there are functions by that name in t...

8 years ago | 0

| accepted

Answered
Most average simple path, algorithm using "middle neighbor"
Having thought about this, all you need to do is create a new distance matrix, thus a cost matrix, based on the distances. Devia...

8 years ago | 1

| accepted

Answered
How to add only two choices for an input parameter ?
You cannot "add" something to param3. You CAN test to see if param3 is anything else, and then return an error.

8 years ago | 0

Load more