How to plot figure for multiple values

27 Ansichten (letzte 30 Tage)
israa
israa am 9 Sep. 2014
Beantwortet: israa am 10 Sep. 2014
Hi all
I have 15 numbers.mat files , I calculate the max ,mean and min for each one.
My question is how to plot the max,mean and min as the figure below?
  6 Kommentare
José-Luis
José-Luis am 9 Sep. 2014
data = rand(10,3);
plot(data);
israa
israa am 9 Sep. 2014
i dont need any numbers i have a specific values..anyway thanks for you

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

israa
israa am 10 Sep. 2014
My friend solved it for me.. Assume that the 15 (number.mat files) are all in the MATLAB path and all have the same length (for example 100 values in each number.mat)
number_v(1:100,15)=zeros; %create vector with all number.mat files
for i=1:15 %loop for import data from current MATLAB path
v=sprintf('number%d.mat',i);
number=importdata(v);
number_v(:,i)=number(1:100,:);
end
min_v=min(number_v); % min vector
max_v=max(number_v); % max vector
mean_v=mean(number_v); % mean vector
plot(min_v,'r --o','LineWidth',2) % plotting with properties
hold on % keep holding the same figure
plot(max_v,'k --*','LineWidth',2)
plot(mean_v,'--p','LineWidth',2)
hold off
So thanks for him ^_^

Weitere Antworten (1)

Andrew Reibold
Andrew Reibold am 9 Sep. 2014
When a figure is open, use
hold on
before plotting to keep putting more plots on the same figure

Kategorien

Mehr zu 2-D and 3-D Plots 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