Thursday 8 December 2011

Matlab Subplot Example | Simple matlab Subplot example.

Subplot is the group of plots in one figure item.This type of plotting used to comparisons.While in your result shows maximum amount of figures shows that time you have use this type of plots.Subplot shows multiple plots in same Figure window.This subplot syntax as follows

>>subplot(row,columns,plot index) ;

row -> Represent you choose the row amount of plot
columns -> Represent you choose the columns of plot
plot-index -> Plot index

Following example shows the subplot best and simple example.
>> x1 = rand(10,1);
>> x2 = rand(10,1);

>> x3 = rand(10,1);

>> x4 = rand(10,1);

>> subplot(2,2,1);plot(x1);

>> subplot(2,2,2);plot(x2);

>> subplot(2,2,3);plot(x3);

>> subplot(2,2,4);plot(x4);

here total 4 plots used so we split subplot 2,2,This split we choose and split,we also use following types of spiting plot,4,1, and 1,4,


Two subplot index has used in one subplot example as follows,

>>x1 = rand(10,1);
>>x2 = rand(10,1);
>>x3 = rand(10,1);
>>subplot(2,2,1);plot(x1);
>>subplot(2,2,2);plot(x2);
>>subplot(2,2,[3 4]);plot(x3);

here last one subplot used two subplot indexes.That indexes are 3 and 4.This output as follows.

Kindly Bookmark and Share it:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...