Plotting frequency with different vector error
이전 댓글 표시
I am trying to plot a frequency graph with the center at the origin but I keep getting the error that the two vectors are different lengths. Is there anyway to fix this?
댓글 수: 3
Walter Roberson
2020년 9월 8일
What is size() of your independent variable? What is size() of your dependent variable? Which plotting routine are you using?
Jackson
2020년 9월 9일
Walter Roberson
2020년 9월 9일
What input are you using? When I tried in R2020a on Mac and used 'hello' as the ASCII input, I had no problem.
답변 (1개)
Amrtanshu Raj
2020년 9월 11일
Hi,
To get the desired shift so that the graph is symmetric about the origin, you can make the following changes in your code where you plot the ‘freq’ variable:
sz = length(freq)/2;
k = [-sz:-1,1:sz];
plot(k,abs(freq));
카테고리
도움말 센터 및 File Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!