Polyfit will not work on my computer.

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

KSSV
KSSV 2017년 11월 14일
It should work actually....can you tell what does which polyfit show up?
Rob Giagnorio
Rob Giagnorio 2017년 11월 14일
I'm sorry, I'm not the best at matlab, what do you mean by which polyfit?
KSSV
KSSV 2017년 11월 14일
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
Rob Giagnorio 2017년 11월 14일
C:\Program Files\MATLAB\R2017a\toolbox\matlab\polyfun\polyfit.m
That is what I got from that
KSSV
KSSV 2017년 11월 14일
You got a tool box...so it should work....
Rob Giagnorio
Rob Giagnorio 2017년 11월 14일
Yeah, I have no idea what is happening. I've tried multiple different codes, deleting and retyping, just about everything. My professor said no one else has had that problem and he has no clue what is going on.
Which check
which -all max
I suspect you might have your own max.m interfering in the computation.
Rob Giagnorio
Rob Giagnorio 2017년 11월 14일
편집: Walter Roberson 2017년 11월 14일
which -all max
built-in (C:\Program Files\MATLAB\R2017a\toolbox\matlab\datafun\max)
C:\Program Files\MATLAB\R2017a\toolbox\matlab\datatypes\@categorical\max.m % categorical method
C:\Program Files\MATLAB\R2017a\toolbox\matlab\timefun\@duration\max.m % duration method
C:\Program Files\MATLAB\R2017a\toolbox\matlab\timefun\@datetime\max.m % datetime method
C:\Program Files\MATLAB\R2017a\toolbox\matlab\bigdata\@tall\max.m % tall method
C:\Program Files\MATLAB\R2017a\toolbox\matlab\timeseries\@timeseries\max.m % timeseries method
this is what i got there
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
Rob Giagnorio 2017년 11월 14일
which sort built-in (C:\Program Files\MATLAB\R2017a\toolbox\matlab\datafun\@double\sort) % double method
Rob Giagnorio
Rob Giagnorio 2017년 11월 14일
Ummm... when it stops in the debugger could you show
which size
size(A)
A

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2017년 11월 14일

0 개 추천

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

Rob Giagnorio
Rob Giagnorio 2017년 11월 14일
Sorry, how do I go about stepping through the code?
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
Rob Giagnorio 2017년 11월 14일
Walter Roberson
Walter Roberson 2017년 11월 14일
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
Rob Giagnorio 2017년 11월 14일

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Time Series Events에 대해 자세히 알아보기

제품

질문:

2017년 11월 14일

댓글:

2017년 11월 14일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by