Matlab drawing a local magnified figure (Summary and summary)

Source: Internet
Author: User

Transfer from http://blog.sina.com.cn/s/blog_4d7c97a00101i7k5.html

As usual thank the original author, the Audience, Amen!

The following three ways, szlqq345 like to use the first kind.

The first kind: magnify is a dynamic magnifying glass, after curing can be used tools>edit plot to move the small map, can select multiple local plots, this method is good

Usage: Open Figure chart, input magnify, left button dynamic selection view, CTRL + Left key curing, can also right-click Cure, ' < ' and ' > ' Zoom method Range, ' + ' and '-' zoom magnification ratio

Original posts: http://www.mathworks.com/matlabcentral/fileexchange/5961

The second type: It is also very convenient to use, the disadvantage is only one box selected, you can not select more than one.

Original posts: http://www.ilovematlab.cn/viewthread.php?tid=913

American scholar Duane Hanselmanandbruce Littlefield wrote the example of MasteringMATLAB7, the implementation diagram of the zoom function, using 3 functions, these three functions in the attachment, of course, can also go to the site http ://www.eece.maine.edu/mm/to download.
Function Brief Introduction:
GETN () simplifies the output parameters of the Get () function to a single variable;
Getbox () implements the selection of rectangular regions and captures the range of the area's horizontal scales
Mmzoom Create a scaling axis.

Try to do an example, and send it together to share.
Example:


x =-pi:pi/12:pi;
y = tan (sin (x))-Sin (tan (x));
plot (x, Y, '--ro ', ' linewidth ', 2, ' markeredgecolor ', ' k ', ' markerfacecolor ', ' G ',
' Markersize ', 7.5)
Mmzoom

The Third Kind: can also make up a small program, respectively in two graphics handle drawing, can learn from the next

Original Posts: Http://www.ilovematlab.cn/redirect.php?fid=6&tid=56146&goto=nextoldset&sid=BpnOkT

Code

Figure (1);
H2=axes (' position ', [0 0 1 1]);
Axis (H2);
X2=0:pi/50:2*pi;
Y2=sin (x2);
H3=plot (X2,y2, ' B-');
H1=axes (' position ', [0.3 0.2 0.4 0.4]);
Axis (H1);
X1=0:pi/50:2*pi;
Y1=cos (x1);
H4=plot (x1,y1, ' R ');
On
H=[h3; H4];
Str=[' The curve in the big picture '; The curve in the small graph '];
Legend (H,STR);

Look down, or prefer the third method to enlarge the local image using the Axes method, the detailed explanation about axes see http://5460521xp.blog.163.com/blog/static/6908756920122210253741/

figure;% Creating a new graphics window
Plot (t,y); axis (' equal '); % plot overall graph

Axes (' Position ', [0.18,0.62,0.28,0.25]); % generate sub-diagram

Plot (t1,y1); % plot local graph
Xlim ([min (T1), Max (T1)]); % Set Axis range


axes The parameter description after the function, with the horizontal ordinate range as the datum:

Example 0.18 is the normalized horizontal position of the lower left corner of the sub-graph:

(The horizontal axis of the position-the starting value of the horizontal axis)/Horizontal range = 0.18,

Similarly, 0.62 is the normalized ordinate position in the lower-left corner of the sub-graph:

(Ordinate-ordinate start value for the position)/ordinate range = 0.62,

0.28 is the normalized width of the sub-graph, 0.25 is the normalized height of the sub-graph, the specific calculation process is the same as

An axis object is built using the axes function, which is called in the following format:
Handle variable =axes (property name 1, property value 1, property name 2, property value 2, ...)
Call the axes function to create an axis in the current drawing window with the specified property and assign its handle to the handle variable on the left. You can also use the Axes function to create an axis in the current graphics window by using MATLAB default property values:
Axes or handle variable = axes
After you establish an axis with the axes function, you can also call the axes function to set it as the current axis, and the graphics window where the axis is located automatically becomes the current drawing window:
Axes (axis handle)

Matlab drawing a local magnified figure (Summary and summary)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.