# Changing from logarithmically spaced

5 Ansichten (letzte 30 Tage)
S am 28 Feb. 2024
Kommentiert: S am 27 Mär. 2024
I currently have a function which gives me center frequencies, but I want to change the chape to be more like the attached. What I have right now is similar to this but flipped, how can I change my code to give me center frequencies shapes like the image? Thank you for your time!
fs = 20e3;
numFilts = 32; %
filter_number = 5;
order = 4;
CenterFreqs = logspace(log10(50), log10(8000), numFilts);
figure
plot(CenterFreqs)
title('Center Frequncies')
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (2)

Mann Baidi am 28 Feb. 2024
Bearbeitet: Mann Baidi am 28 Feb. 2024
Hi,
As per the information provided, I can understand that you would like to shape your graph same as the shape of image shared. I would suggest you to plot the data of the 'CenterFreqs' by multiplying it -1 and plot the graph in the -ve -axis. So, basically plotting the mirror image w.r.t the origin (0,0). You can use this modified code:
fs = 20e3;
numFilts = 32;
filter_number = 5;
CenterFreqs = logspace(log10(50), log10(8000), numFilts);
plot(CenterFreqs)
title('Original Graph')
figure
CenterFreqs=-1*CenterFreqs; % Mirror image w.r.t to x-axis
plot(-1:-1:-32,CenterFreqs) % Mirror image w.r.t to y-axis
title('Desired Graph')
Hoping this will help in resolving the issue!
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Dyuman Joshi am 29 Feb. 2024
fs = 20e3;
numFilts = 32;
filter_number = 5;
order = 4;
CenterFreqs = logspace(log10(50), log10(8000), numFilts);
figure
plot(CenterFreqs, 'DisplayName', 'Original Plot')
hold on
%flipping x and y values accordingly
plot(flip(1:numel(CenterFreqs)), max(CenterFreqs)-CenterFreqs, 'DisplayName', 'Modified Plot')
title('Center Frequncies')
legend('Location', 'best')
##### 5 Kommentare3 ältere Kommentare anzeigen3 ältere Kommentare ausblenden
Dyuman Joshi am 26 Mär. 2024
S am 27 Mär. 2024
@Dyuman Joshi Yes so if I want to resave these flipped y values under centerfreqs, I could just do
CenterFreqs=flipy_values because when I do this it messes up the rest of my script when it should just be the reverse of the original CenterFreqs

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Annotations finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by