Plotting frequency with different vector error
13 次查看(过去 30 天)
显示 更早的评论
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-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));
0 个评论
另请参阅
类别
在 Help Center 和 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!