While calculating power spectral density it is showing an error , vector lengths must be same

조회 수: 3 (최근 30일)
I am calculating power spectral density of voltage and time values from an excel sheet of 2 columns and 9689 rows. while plotting the graph it is throwing an error "Error using plot Vectors must be the same length. Error in lpf (line 19) plot(fc,Nc)" Please help me out. I am attaching the code file in the above attachment.

채택된 답변

Star Strider
Star Strider 2017년 11월 25일
I cannot run your code, however I believe I see the problem.
First, delete this line:
Nc(2:end-1) = 2*Nc(2:end-1);
and change the plot calls to:
plot(fc,Nc(1:length(fc))*2)
and:
plot(fc,10*log10(Nc(1:length(fc))*2));
That should work.
  댓글 수: 12
dark lion
dark lion 2017년 11월 25일
Got it ! thank you very much for your patience I suck at matlab
Star Strider
Star Strider 2017년 11월 25일
As always, my pleasure!
No, you don’t. You simply need time with it. None of us entered this workd knowing how to program.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by