Answered
How to make no roundings on decimals
WTP? A = sym('686943676869436768'); A = 686943676869436768 mod(A,100) ans = 68 Or you can use my HPF or...

10 years ago | 0

Answered
How to plot a quadratic equation?
It is not a quadratic equation in the classic use of that phrase. It is the implicit equation of a conic form in 3 three dimensi...

10 years ago | 2

Answered
Having problem with the ode45 solver
Problems with large variations in coefficients are often described as stiff. You can think of it as a problem with several thing...

10 years ago | 1

| accepted

Answered
how to find inverse of matrix size nxn?
HMM. Are you trying to invert an image using atool like inv, but not understand that what you really wanted to do is to turn bla...

10 years ago | 1

| accepted

Answered
how to find inverse of matrix size nxn?
Just use inv. WTP? You said that you tried it on a binary IMAGE? Why in the name of god and little green apples would you do ...

10 years ago | 0

Answered
Using fsolve with array of symbolic expressions
fsolve is not designed to work with symbolic expressions. PERIOD. If you have symbolic coefficients in there, fsolve is NOT f...

10 years ago | 3

| accepted

Answered
fslove Equation with variable coefficients
Of course you got an error. Solve one problem at a time. Put the loop outside of the call to fsolve. n = numel(k); X = z...

10 years ago | 1

| accepted

Answered
How to use previous result in objective function?
Once your objective function exits from the previous call, anything you did there gets dumped in the bit bucket. Lost forever. ...

10 years ago | 0

| accepted

Answered
Smoothing data with Filtering
A characteristic of virtually any smoothing scheme is it will tend to round over the peaks and valleys. So what do you expect?

10 years ago | 0

Answered
New ways to speed up a code
Just my take on the question... I once was given a rather nasty (and buggy) code to make work, the author not available for c...

10 years ago | 1

Answered
Solving system of 2 equations
Gy and Gx are distributions. What does it mean to take the product of Gy with some expression, and then try to equate that to a ...

10 years ago | 0

Answered
Problem with fsolve?
The answer is that lambda=0.4, Tout=1100 is NOT the true solution to your equations. You may think it is. But that is wr...

10 years ago | 1

Answered
why I get "complex number" for the common calculation?
There is only one reason why you are getting a complex result there if everything is truly a real number. At least one of the el...

10 years ago | 2

| accepted

Answered
lsqcurvefit error when fitting polynomial but okay for exponential
It helps if you read your own code. :) Yes, I know things like this are sometimes not obvious. Here is the block that matters...

10 years ago | 1

| accepted

Answered
Is there a faster way to multiply a sparse and full matrix than standard multiplication in Matlab?
We understand what a matrix multiply means. :) But it sounds like you don't appreciate the use of sparse matrices in MATLAB. Jus...

10 years ago | 10

| accepted

Answered
vpasolve returns empty sym 0-by-1
Ok, I really think the answer is that not all problems have a solution. I don't see a value for n or w or L, as I could then ...

10 years ago | 0

Answered
PDE heat equation one dimension
This is a script. Functions are not allowed to be defined as m-files, INSIDE a script. Save the function pdex1pde as a separa...

10 years ago | 0

Submitted


The Fibonacci Sequence
Efficient computation of Fibonacci and Lucas numbers

10 years ago | 1242 downloads |

5.0 / 5

Answered
fibonacci - potential bug - Please see the 51st fibonacci number when using modulo 2^16
Turns out, there was a bug in my fibonacci code, that only surfaced in certain circumstances, when computing the mod internally ...

10 years ago | 1

Answered
[num,den]=series(n1,d1,n2,d2,n3,d3); please tell me that in this line which error??
There is no error at all. That is perfectly correct MATLAB syntax, for some (possibly unknown) general function named series. ...

10 years ago | 1

Answered
How to find intersection of two complex curves
Intersect does NOT compute the intersections of two curves. It performs a set intersection. Just because the name is similar, do...

10 years ago | 0

Answered
Inaccurate result when using mod(N,1) or rem(N,1), when N=9/(45*0.0001)
It is not inaccurate. It simply reflects that you don't appreciate floating point arithmetic. Since you cannot represent numbers...

10 years ago | 0

| accepted

Answered
What does "something = cell (size(session,1),1" mean/look like?
Why not think about it? Look at the inside. What does this: size(session,1) do? If you have no clue, then READ THE H...

10 years ago | 1

Answered
LSQNONLIN performances varying according to the input data structure in the residual computation function.
This is just a reflection of fact in the world of optimization. Of a concept called a basin of attraction. And of the curse of d...

10 years ago | 1

| accepted

Answered
Why doesn't my simple PSO work?
Sigh. Is this not the 5'th time or so you have asked this question? When you try to run an optimization, or ANYTHING like thi...

10 years ago | 0

| accepted

Answered
Does the curve fitting toolbox have power regression?
Read the help. Under doc fit, it told me to look at "List of Library Models for Curve and Surface Fitting". Under there, I lo...

10 years ago | 0

| accepted

Answered
How to plot a surface with gridded data of x,y,z, and p vectors?
What are you going to plot? And wha are you planning on using to view it with? Remember that you are using a monitor, or a pi...

10 years ago | 0

Answered
Extracting n elemnts of an array
Why do you think that you need to create 116 different arrays? This is a terrible idea, and one every novice programmer thinks t...

10 years ago | 0

| accepted

Answered
How can I take part of vector
It is time for you to read the getting started tutorials about MATLAB. In there you will have learned to use indexing, and such ...

10 years ago | 4

| accepted

Load more