首页 > 其他 > 详细

Matlab setting & snippet

时间:2020-07-07 01:09:30      阅读:61      评论:0      收藏:0      [点我收藏+]

代码片段snippets

  • 保存pdf调整a4纸至合适大小
h = figure;
plot(1:10);
set(h,'Units','Inches');
pos = get(h,'Position');
set(h,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)])
print(h,'filename','-dpdf','-r0')
  • 缺省参数默认值设定
function f(arg1, arg2, arg3)
if ~exist('arg2', 'var')
    arg2 = arg2Default;
end
hg1 = legend('第一条');
set(hg1,'FontSize',12,'Location', 'SouthOutside','box','off');  
%注:将legend放在图外面时,Legend 1不能通过鼠标移动,只能通过代码调整位置 
% ============= Legend 2 :
ah2 = axes('position',get(gca,'position'),'visible','off');
hg2 = legend(ah2, [p2 p3], '第二条', '第三条');
set(hg2,'FontSize',12,'Location', 'SouthOutside',...
        'Orientation','horizontal','box','off');

Another way:
legend({'cos(x)','cos(2x)','cos(3x)','cos(4x)'},'Location','northwest','NumColumns',2)

  • mac打开时闪退 /Applications/Polyspace/R2019b.app/bin/matlab -nosplash
  • matlab-mex命令 10.15.4问题 https://www.mathworks.com/matlabcentral/answers/512901-mex-xcodebuild-error-sdk-macosx10-15-4-cannot-be-located/?s_tid=mlc_lp_leaf

绘制等高线

contour(u, v, z, [-0.5, -0.5], 'LineWidth', 2)

区间是zlim

Matlab setting & snippet

原文:https://www.cnblogs.com/tolshao/p/matlab-she-zhi.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!