Answered
How can I get more than one solution with solve()?
You have ONE equation, and TWO unknowns. There are infinitely many solutions. Do you expect MATLAB to generate them all? Get som...

6 years ago | 0

Answered
Optimization variable zero or one
You have 10 variables, which can take on only 2 levels each. Just evaluate the function at all 2^10 = 1024 points and be done wi...

6 years ago | 0

Answered
Solving 3 equations with 3 unknows
No algebraic solution exists, at least not that it could find. I'm not at all surprised at that, Th is inside and outside of the...

6 years ago | 0

| accepted

Answered
How to solve linear equation with singular Matrix?
A difficult question to answer, because there is no unique solution, and very likely, there is no exact solution. Really, it com...

6 years ago | 0

Answered
How can I get confidence intervals in matlab using fmincon?
@george hargenrader, as well as @Sean Quinn, but probably too late for the OP... You are using fmincon because there are constr...

6 years ago | 0

Answered
Displaying symbolic function with decimal number instead of fractional coefficients
Just use vpa. help vpa

6 years ago | 0

| accepted

Answered
Hi i am new. Kindly help me making this code.
What did you try? Is there a reason why you did not try symsum? TRY IT! help symsum I will even point pout that symsum allows...

6 years ago | 0

| accepted

Answered
Derivative of a function with value of x
You want to find the derivative of a function. First, create the function in a symbolic form. syms x f = log(x); So f is a va...

6 years ago | 0

Answered
curve fitting or optimisation toolbox
A lot depends on what you would be doing. For myself, both toolboxes are hugely valuable. I'd get them both. :) But really, if ...

6 years ago | 1

Answered
How to solve this summation with exponential in Matlab?
If you are not careful, you will need to use a tool with literally thusands of digits of precision, as those terms will vary by ...

6 years ago | 1

| accepted

Answered
curious behavior of geomean
As is always the case, consider what MATLAB release you are using. x = 1:10; x(3) = nan; % Replace the third element of x with...

6 years ago | 0

| accepted

Answered
Solve a variable in equation
Just use solve. Or vpasolve will also suffice, since this is a polynomial, vpasolve will give all solutions. lamb = solve(f_lam...

6 years ago | 2

Answered
fsolve no solution found.
Consider this simple function of one variable. fun = @(x) (x-1).*exp(-x) + 0.5; fplot(fun,[0,10]) yline(0); grid on As you ...

6 years ago | 0

Answered
Repeating entries of blkdiag
B = ones(2); BB = repmat({B},1,5); BDiag = blkdiag(BB{:}); spy(BDiag) Create a cell array. Then use blkdiak properly, by t...

6 years ago | 0

| accepted

Answered
how to identify certain variables as constants?
Why not try it? syms A B w0 t phi psi syms n positive integer V = A*cos(w0*t + phi)*B*sin(n*w0*t + phi + psi); int(V,psi,[...

6 years ago | 0

| accepted

Answered
solving sin(x) by solve commad?
Um, is it not true that sin(0) == 0? You ask why? It happens to be the correct answer. At least, A correct answer. And since the...

6 years ago | 0

| accepted

Answered
Help with coin toss loop
There is no need to use a loop. First, get used to using meaningful variable names. You have samplesize, and nsamples. What do ...

6 years ago | 1

| accepted

Answered
How to split a vector into smaller vectors to run a recursive function more efficiently
Be serious. Why would you want to do this if it were not homework? Problems like this are just things assigned to students to t...

6 years ago | 0

Answered
compute symbolic eigen values
You need to understand that when you pose a symbolic eigenvalue problem, this is equivalent to finding the roots of the characte...

6 years ago | 0

| accepted

Answered
Undefined function or variable
When you want to return results from a function, if there are more then ONE output, use square brackets. [k_distances,k_indice...

6 years ago | 0

| accepted

Answered
“Regression design matrix is rank deficient” - what to do next?
You already know what to do. Get more data, and perhaps as importantly, get better data that better fills out the design space. ...

6 years ago | 3

| accepted

Answered
Three exponential fit with curve fitting toolbox
You an always define your own custom model using fittype. Nothing stops you. But multiple term sums of exponential fits are ofte...

6 years ago | 1

Answered
While loop to estime pi
A hint as to the major problem... Your loop is defined by: while abs(k-pi)<0.5*10^-5 So as long as this is TRUE, the loop wil...

6 years ago | 1

Answered
Can I Do These Kinds of Things In MATLAB, Or Is There Another Program That's Better For This?
Can you do it with MATLAB? Of course. MATLAB allows matrices with any number of dimensions. In fact, a scalar is really a matrix...

6 years ago | 1

| accepted

Answered
Rearrange of matrix or vector
You want to MOVE the 3 and 7 elements to the beginning of the vector? A = [ 1 2 3 4 5 6 7 8 9 ]; B = A; B([3 7]) = []; B =...

6 years ago | 0

Answered
Mirror plotting a curve
You must have plotted the curve using a call like plot(x,y,'-b') But then, what would the following do? plot(-x,y,'-b')

6 years ago | 0

Answered
Is there a significant advantage in hand-writing MEX code vs using the automatic MATLAB Coder project?
Are you good at coding? How good? If so, then you can probably improve on automatically generated code. However, it is also oft...

6 years ago | 0

Answered
How to aproximate a set of points into a polynomial parametric spline
Download my interparc utility, which does exactly what you want, though it is not a polynomial tool, but a spline tool. Lacking ...

6 years ago | 0

Answered
Matrix question problem solving
The most likely answers would be NaN or []. However there are good arguments the answer should be 42.

6 years ago | 1

Answered
integral of f by Milne's method
You are using what appears to be a closed form Newton Cotes rule, commonly known as Booles rule. https://en.wikipedia.org/wiki...

6 years ago | 0

| accepted

Load more