Why would circshift stop working.

조회 수: 6 (최근 30일)
Douglas Brenner
Douglas Brenner 2018년 12월 9일
답변: Douglas Brenner 2018년 12월 9일
There is no evidence that circshift is working. The two plots are the same whereas yesterday a clear shift in the plots can be see. I have also printed out spect2 before and after the shift and there is none.
Using Matlab 2014
Before
Columns 49 through 56
0.570245000000000 0.570246000000000 0.570247000000000 0.570248000000000 0.570249000000000 0.570250000000000 0.570251000000000 0.570252000000000
3.848182812500000 3.704242187500000 3.475567187500000 3.204188671875000 2.899719335937500 2.559822851562500 2.223999414062500 1.932186718750000
After
Columns 49 through 56
0.570245000000000 0.570246000000000 0.570247000000000 0.570248000000000 0.570249000000000 0.570250000000000 0.570251000000000 0.570252000000000
3.848182812500000 3.704242187500000 3.475567187500000 3.204188671875000 2.899719335937500 2.559822851562500 2.223999414062500 1.932186718750000
  댓글 수: 1
Jan
Jan 2018년 12월 9일
편집: Jan 2018년 12월 9일
The question is not clear yet. Why do you claim that circshift is "not working", and what does this exactly mean? Maybe you instruct circshift to shift the data by 0 elements or by the number of elements, such that the output equals the input?

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

채택된 답변

Star Strider
Star Strider 2018년 12월 9일
편집: Star Strider 2018년 12월 9일
What is the value of ‘td’? If it is 0, you won’t see any shift.
Is ‘spect2’ a vector or a matrix? (I couldn’t tell from your code.) If it’s a matrix, circshift will operate on the rows by default, with the syntax you’re using with it. You may need to tell it to operate on the columns.

추가 답변 (2개)

Jan
Jan 2018년 12월 9일
Use the debugger to find out, what happens: https://www.mathworks.com/help/matlab/matlab_prog/debugging-process-and-features.html . Set a break point in the line, which does not do, what you expect. Then check the values of the variables, here most likely the number of shifted elements.
Remember that function do not stop working. They are not tired or in a bad mood. Either you have modified a function, e.g. by creating an own function called 'circshift.m'. Then the function does work, but you do call another one. Or the function does exactly what its inputs instruct it to do, but these inputs are not, what you expect them to be. Or the function works and the method you apply to checking the results is flawed.

Douglas Brenner
Douglas Brenner 2018년 12월 9일
I had been transposing matrics and released this morning as I was waking that this must have been the problem.
Thanks.

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by