您的位置:首页 > 编程语言 > MATLAB

将matlab中用plot绘制的图片保存为任意大小的jpg图片

2010-03-03 17:24 459 查看
handle = figure;

Position = get(handle, 'Position');
set(handle,'PaperPositionMode','auto');

 

%该图片会被保存为566*550大小的图片
set(handle,'Position',[Position(1:2),566,550]);

 

 

%利用plot绘图

x1 = 0.01 : 0.01 : n*pi;
y1 = sin(x1) ./x1;
x2 = -n*pi : 0.01 : -0.01;
y2 = sin(x2)./x2;
y = [y2 y1];
x = [x2 x1];
plot(x,y);

 

%保存图片为test.jpg
print(handle,'-djpeg','-r0','test.jpg');

 

 

更多内容请参考:http://www.mathworks.cn/matlabcentral/newsreader/view_thread/244905
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  plot matlab
相关文章推荐