Drawing a Jug- Matlab Fun

Posted on at


Drawing a Jug- Matlab Fun

Following is the description of a MATLAB fun code which makes a water jug when executed. It is created by using the data previously saved in an excel file. The commands used are xlsread, for loop, getframe only. It is very simple to use. 

Matlab Code:

clear all
close all
data=xlsread('jug.xlsx');
x=data(:,1);
y=data(:,2);
for i=1:length(x);
hold on
plot(x(i),y(i),'.k','MarkerSize',20)
F(i)=getframe;
end

Output:

 

For other images of outputs using a little variation in code for color, CLICK HERE

For further assistance watch the following video

 

You can also download the data file jug.xlsx

There is a lot more about MATLAB. Visit my blogs and videos by clicking the following links.

My Videos

My Blogs

 



About the author

SalmaAnnex

Haripur, Pakistan

Subscribe 0
160