bar graph command for range values
Show older comments
sdad
2 Comments
Image wasn't attached...but, need to know which data are where in the array to collect how want. bar generates a bar for each column so apparently
size(ampsCAP) returns 4,8?
W/O knowing just where is what, can't provide exact code but look at the examples of how to use the various options in bar in the documentation including being able to specify a x-variable to group data.
Stephen23
on 26 Mar 2020
Original question:
I have a program written by my supervisor that outputs a bar graph (latest version of Matlab on Windows 10-64 bit) for each variable (ampsCAP) as follows:
if numtests > 1
figure1 = figure('Color',[1 1 1]);
subplot(141); bar(ampsCAP(1,:)); title([int2str(Cs(1,1)) ' Hz']);
subplot(142); bar(ampsCAP(2,:)); title([int2str(Cs(2,1)) ' Hz']);
subplot(143); bar(ampsCAP(3,:)); title([int2str(Cs(3,1)) ' Hz']);
subplot(144); bar(ampsCAP(4,:)); title([int2str(Cs(4,1)) ' Hz']);
end
This outputs 4 sets of frequencies (500, 1000, 2000, 3000). Each frequency has 8 bars (each bar represents the amplitude of the modulator) for two conditions (normal, noise-exposed) with two levels (100% modulation, 50% modulation). For example, in the figure for 500 Hz:
#1 is normal at 100% modulation for the first modulator
#2 is noise-exposed at 100% modulation for the first modulator
#3 is normal at 50% modulation for the first modulator
#4 is noise-exposed at 50% modulation for the first modulator
I need to output this differently so that I have only two graphs with four frequencies (500, 1000, 2000, 4000) in each graph for the two conditions(normal, noise-exposed) in one graph (i.e.,100% modulation depth) and four frequencies for two conditions in the other graph (i.e, 50% modulation depth) in the other graph. I don't know how to re-write the above code to let me do that. I have attached an image of what the above code outputs.
Accepted Answer
More Answers (0)
Categories
Find more on Title in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
