Polyfit will not work on my computer.
Mostrar comentarios más antiguos

The code is correct and I copied and pasted it into my friends matlabs and it works fine. I keep getting the following error code on mine whenever I try it. I got polyfit to work with just single numbers but whenever I plug in variables that are representing matrices, it will not work.
12 comentarios
KSSV
el 14 de Nov. de 2017
It should work actually....can you tell what does which polyfit show up?
Rob Giagnorio
el 14 de Nov. de 2017
KSSV
el 14 de Nov. de 2017
type which polyfit in your work space.....and tell us the result...IN my PC it shows up:
C:\Program Files\MATLAB\R2017a\toolbox\matlab\polyfun\polyfit.m
Rob Giagnorio
el 14 de Nov. de 2017
KSSV
el 14 de Nov. de 2017
You got a tool box...so it should work....
Rob Giagnorio
el 14 de Nov. de 2017
Walter Roberson
el 14 de Nov. de 2017
Which check
which -all max
I suspect you might have your own max.m interfering in the computation.
Rob Giagnorio
el 14 de Nov. de 2017
Editada: Walter Roberson
el 14 de Nov. de 2017
Walter Roberson
el 14 de Nov. de 2017
That does look okay.
At the command line, command
dbstop if error
and run the program. When it stops with the error about index exceeded, please show
n
size(m)
m(n)
size(Y)
Also please show the output for
which sort
Rob Giagnorio
el 14 de Nov. de 2017
Rob Giagnorio
el 14 de Nov. de 2017
Walter Roberson
el 14 de Nov. de 2017
Ummm... when it stops in the debugger could you show
which size
size(A)
A
Respuestas (1)
Jan
el 14 de Nov. de 2017
The problem occurs in normest1. The failing line looks unsual for Matlab code:
est = full(temp(n)); v = zeros(n,1); v(m(n)) = 1; w = Y(:,m(n));
Matlab's JIT acceleration cannot work properly, if you write multiple commands in one line. So is this really written by MathWorks?
When n=2 and m is a scalar, the code must fail. Step through the code of normest1 to find the meaning of these variables.
5 comentarios
Rob Giagnorio
el 14 de Nov. de 2017
Walter Roberson
el 14 de Nov. de 2017
dbstop in normest1
Run the code. It will stop at the first executable line of normest1. You can then examine variables and
dbstep
to execute a line at a time.
Rob Giagnorio
el 14 de Nov. de 2017
Walter Roberson
el 14 de Nov. de 2017
It is not normest1 that you should execute after the "dbstop": you should invoke polyfit like before. When it stops in normest1 then you can look at the inputs and dbstep through the lines.
Rob Giagnorio
el 14 de Nov. de 2017
Categorías
Más información sobre Time Series Events en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


