Home  >  Article  >  Computer Tutorials  >  How to adjust scope’s timeline settings in MATLAB

How to adjust scope’s timeline settings in MATLAB

王林
王林forward
2024-01-20 08:24:051682browse

How to adjust scope’s timeline settings in MATLAB

How to set the timeline of scope in matlab

Set Timeline

ts=datenum('1999-01-01 00:00:00'); % start time

tf=datenum('1999-01-01 00:20:00'); % end time

y=rand(21,1);% gives your y value, I gave it randomly

t=linspace(ts,tf,21);% 21min is the total time

plot(t,y);% Call datetick function to directly generate time coordinates

datetick('x','HH:MM','keepticks')

Matlab can be used to easily draw time series, but setting the timeline may be difficult, especially the setting of secondary scales and label positions. Therefore, plotting the time series using GMT makes plotting the secondary monthly labels more convenient.

Section 1: Time Series

Draw the time series, manually adjust the coordinate scale, one year is a main tick (main ticks), one month is a minor tick (minor ticks), and draw the Y coordinate grid.

Specific steps are as follows:

1. First, prepare the rule data. If the data format is the matrix format processed and stored by MATLAB, you need to extract the time series using MATLAB and save it as ASCII format data. Note that the data at this time does not contain time information, it is just a simple column of data. We will add time information later.

2. Add time column [h2]

to sigma0 data

This method is not fixed. You can program it yourself or use an existing simple program. Note that the format of time data is fixed.

If there is not much data, you can use the excel that comes with Windows to add it.

The final data format of this example is as follows: the first column is time, the second to fourth columns are the attribute values ​​of sigma0,

(time,sigma0Ku,sigma0C,sigma0C-Ku).

3. GMT drawing

Put three columns of sigma0 data on one graph, that is, draw three time series at the same time, and use the same coordinate system. The abscissa is the year and month, and the specific settings are: the year is the large scale, the month is the small scale, and the limit is set to 1993.1.1-2004.12.1. The vertical coordinate is the value of sigma0. The range can be considered known and set to 0-15.

Refer to Procedure 21 in the GMT Cookbook:

The Time format in GMT needs to be set according to the time format of the data. It can be found in the help file of GMT, including Gregorian, ISO and so on. Also distinguish between the input time format and the output time format.

Select the time standard dd-o-yy used in Example 21. (GMT has detailed time setting parameters, so be careful not to make mistakes in this step.)

Note: The date coordinates of the time series in the data file can be in different formats from the marked date coordinates, but they must be consistent in time.

About matlab programming How to use Plot to make graphs with char type time format

You can tell it’s a copy at a glance

If you want to use jpg or png images in symbian, you need to use the class in the Multimedia ICL library provided by symbian. The more important one is the CImageDecoder class, which provides the function of decoding images.

Let’s see how to use it. First define two strings:

_LIT(KJPEGFile,"C:\\Data\\me.jpg");

_LIT(KJPEGType,"image/jpeg");

The code used is relatively simple, as shown below:

iDec = CImageDecoder::FileNewL(iRFs,KJPEGFile);

iParent->iBkImageMask=new (ELeave) CFbsBitmap();

iParent->iBkImageMask->Create( iDec-> FrameInfo().iOverallSizeInPixels,iDec-> FrameInfo().iFrameDisplayMode );

iDec->Convert( &iStatus, *(iParent->iBkImageMask) );

iDec is an instance of CImageDecoder, and iRFs is an instance of RFs. And iParent->iBkImageMask is a CFbsBitmap object instance.

In other words, we first use CImageDecorder::FileNewL to open an image file (it will determine the image type by itself, and we can also provide it with the image type we specify). Then the information of this image is saved in iDec->FrameInfo(). This information can be used to create a CFbsBitmap instance (because all images displayed in Symbian are of this type). Finally, the image (in jpeg or png format) can be converted into a CFbsBitmap bitmap by calling the asynchronous function Convert of CImageDecorder. The only trouble is that Convert is an asynchronous function, and the first parameter is of type TRequestStatus (which can be the iStatus member of an active object).

In addition to CImageDecorder::FileNewL, there is also CImageDecorder:;DataNewL, which can also be used to construct image data from the byte content of a buffer, except that its second parameter is aSourceData of TDesC8& type.

[Replenish]

Don’t forget to include the header file ImageConversion.h and the import library imageconversion.lib.

How to change the abscissa axis when using datetick function in matlab

You can use additional parameters to specify the original coordinate axis range:

datetick('x','yyyy-mm-dd','keeplimits') If you are not satisfied with the tick of the coordinate axis, you can keep the original tick:

datetick('x','yyyy-mm-dd','keepticks') But the original Tick may not be suitable for the date format. Then, you can consider setting the Tick you think is appropriate before calling datetick, for example :

DateString = {'06/1/2014';'10/1/2014';'02/1/2015';'06/1/2015'};

formatIn = 'mm/dd/yyyy';

set(gca,'xtick',datenum(DateString,formatIn))

datetick('x','yyyy-mm-dd','keepticks') However, this is a bit too cumbersome, so it is better to set the TickLabel directly.

The above is the detailed content of How to adjust scope’s timeline settings in MATLAB. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:docexcel.net. If there is any infringement, please contact admin@php.cn delete