A short description of Matlab. Matlab

Zharoznizhuvalny for children is recognized as a pediatrician. Allegedly, there are situations of inconvenient help for feverish women, if the children are in need of giving innocently. Todi dad take on the versatility and constipation of fever-lowering drugs. How can you give children a breast? How can you beat the temperature of older children? What are the best ones?

It is unimportant to reach the high popularity of the MATLAB language, the majority of products are importantly represented, both the syntax and the possibilities. Everything on the right is that the mova is tied to a popular software product, the part of which can reach the tricky meaning. Well, the smut of food: why is it good without Matlab? And we can be honest with you.

Vikoristannya

Almost not because of the standard course in history and discussion of the plus and minus of the move, but from the MATLAB / Simulink software middleware - a single piece, the hero of the text can be simple. You just need to find out that you are a graphic editor, in which case you can realize your idea, do not go by the shoulders of a bit of rocky news of the latest news. Once you have opened the scheme of interaction of tools, you can edit the script for bagatorazovy vikorystannya.

MATLAB is the very same editor in the world. The area of ​​such storage is immeasurably wide: IoT, finance, medicine, space, automation, robotics, mouthless systems, and a lot of it. There is a greater possibility of obtaining and visualization of money, as well as the forecast, but also the possibility of buying a specific package.

Well, there is no price, then the upper boundary is not big, and the lower axis is in the region of $ 99. This is such a tedious product for a relatively small penny, you need to be a student of the Higher Education Institution. I, very well, you can remove the food from the food.

Features movi

Mova MATLAB is a tool that will take care of the operator's interaction (often referring to a non-programmer) due to the available possibilities for analyzing, collecting and submitting data. In new and obvious pluses and minus, the authorities are living in a closed ecosystem.

Incomplete:

    It is overwhelmed by operators, commands, functions of the mobile, the main mark of which is the reduction of the visual experience.

    High school directions. Few more software platforms, de b MATLAB buv brown.

    Dorozhnecha PZ. If you’re not a student, you’ll try to empty the clutches, or go over the line between the law. If you are a student, the price is decent.

    The unrepentant will drink. It is practically indifferent to the great interest in MATLAB in all spheres, in fact, it’s not a lot of legal work.

Perevagi:

    Mova is easy for vivchennya, simple and intelligent syntax.

    Great powers. Ale tse sooner rewire all product zagalom.

    Part of the update, make sure to check the positive re-implementation will not grow faster than the wager.

    The middleware program allows you to transform it into “smart” code C, Z ++.

Tsilova audit

Zrozumіlo, MATLAB is not required by all. Unimportant to the wide sphere of storage, it is important to know that an ordinary distributor of supplements can know the knowledge of the movement. MATLAB is even brown in areas that require special reliability when processing data, for example, in autopilot systems in cars or on-board electronic systems.

Tobto, if you are not even a programmer, alas, your profession is tied to the need software processing Danih, then the MATLAB / Simulink product will help you understand your work.

Literature

I will conclude with a list of new literature. Among them, you don’t know books, but for all the time you’re going to see it, you’ll be just simpler:

Do you have є robots with MATLAB? The first one?

For quiet, hto want to become a programmer.

Change of change, all changes of type.

Overture

Immediately I'll think about it, MATLAB is a monstrous tool. This is a visual instrument, which they were not victorious for.

Take a look at our company. Our sphere of activity is the distribution of software security for industry and a lot of things. The company has close to 100 people, and I am in the whole company - one of the sportsmen who are engaged in the development of algorithms. Є We have a flagship product that will bring the main income.

The flagship product is business supplement. The new ones have a lot of molds and zvitniks, their own base of data and the numerical core. The numerical core is written in C # without having to write native code. This solution has been praised by the rozrobniki svidomo. Parallel.For was so focused, and C ++ everyone wanted to forget like a bad dream.



Reality, as the price is unreasonable, did not listen to our hopes, and it didn’t start out. Іnsha problem, scho, yak z'yasuvalosya, programs, like bi garnish code did not write, the line algebra has little reason.

Todi is our Golovny Algorithmist proponating the idea. Description of the whole idea and those that came from it and become the essence of the whole statty.

Idea

The idea of ​​a bullet is downtime. Instead of paying a salary to one smart programmer (as if you were thinking of writing good code in C # and having worked in the subtleties of our "matan", and this is not easy to know), you can take two "smart" ones. The first is to write prototypes in MATLAB, the other is to port the solution to C #.
MATLAB at this time was presented as a tool for documenting the algorithm. This decision was voiced by the following perevagi:

  • MATLAB - simple mova, as a programmer can get an update in 1 day
  • The effort of mathematicians to write in MATLAB

Varto means that earlier for documenting the algorithm vicoristovuvsya Mathcad, UML diagrams and navi arkush paper.

We were in a match, but we did not take it. But as a result, the Golovny Algorithmist successfully overcame, and the command of the algorithms was launched, like writing in matlab. Until then, the commanders of the warriors and me. Until our command, we have also managed to upgrade One Programmer from the number of developers, who, I don’t think, would transfer our matlab-ekzersisi to C #.

I respect you, the surroundings of the proposition of being seen from the chain of vitality, the bullet and proposition of the vicorisovati accept python + numpy. I would like for some reason, as well as some meaningful information on the MATLAB distribution, but I didn’t have a problem with anyone (I wrote in python and R before, I’ve written about mathematics and engineering, like a calculator for MATLAB). Propositions, as you can see, see.

Proyshov rik ...

After rіk і at a time, it is already possible to buy the following pids of the bag:

  • Mathematicians can't write code. And in those lokshy, where you go from the pen, you can’t go back and the stench of yourself. No specific knowledge, no information, no culture program
  • As soon as we were introduced to the schemes and Mathcad, then the bazhanna was victorious for our MATLAB programs. We spent an hour on the results of duplicating a part of the functionality of the flagship product on Matlab.
  • Pokey me took up the program, an hour for a robot over Vlasne algorithm overshadowed nebagato
  • MATLAB is not available for retail great programs... Please do not accept us. Dynamically lax typing, general cycles, even more common OOP (the settings that were often viewed from the OOP victorious), not the same way of optimizing the development matrices
  • Porting your MATLAB code to C # is not easy. More foldable backport and refactorings and optimizations
As a result, it is impossible to assess in advance, since an hour is required for the implementation of this information. How long can it be a month?

Replace the connection

On the ear of the statty, I am trifling, because іstorіya prodovzhutsya dosі. We continue to write on MATLAB, our code will continue to be ported to C #. I would like now everything is good, in the idea of ​​the Head Algorithmist є wadi. It’s just fine.

And in just an hour to fix it, talk about the dodatkov re-airing of solutions from MATLAB already in C ++.

As well as a large number of programs, Matlab needs the ability to display mathematical views, albeit, on the view of each of them, as well as include matrices in Matlab. Virazi main warehouses:

Змінні;

Operator;

Opt.

Змінні. Matlab doesn’t require any type of change. If Matlab is new and new, it will automatically open the change and see the message of the memory. As soon as you change it, Matlab changes the warehouse and if you need to see it dodatkov memory... For example,

num_ students = 25

I open with a 1x1 matrix with im'yam num_ students and the value of the 25th for one element.

The name of the change is made up of letters, numbers or symbols for the seat. Matlab has only 31 symbols for change. Matlab is sensitive to registrations, great and small letters. Tom Aі a- not that very wicked. To poke a matrix, tied with a wintry one, just introduce the name of a wintry one.

Numbers. Matlab will accept a tens numerical system, with an optional tens point and plus-minus signs for numbers. Science system of number vikoristovuє letter e The value of the multiplier is a step of ten. Revealed the number of vicorists i abo j yak sufiks. Put the correct numbers on the bottom below:

Usi numbers for zberigannya vikoristovyt format long, tse numbers with a floating point between the precision - approximately 16 significant digits and the range - approximately from 10 -308 to 10 308.

Operator. Virazi vicoristovuyt zychayny arithmetic operations and the rule of precedence (table. 1).

Table 1

Arithmetic operations for Matlab

Opt. Matlab has a large number of elementary mathematical functions, such as abs, sqrt, exp, sin. Calculating the square root of the logarithm of a negative number є with a pity: if the result є is a complex number. Matlab also has more folding functions, including the Gamma and Bessel functions. Most of these functions may have complex arguments. To keep a list of all the elementary mathematical functions, type:

helpelfun

Just look over the look of the Matlab functions for analyzing the data:

helpdatafun

If you need to know about StatisticsToolbox, enter:

helpstats

The list of elementary functions is given in table. 2.

Table 2

Elementary functions of the Matlab package

Logarithm of the number on the display :.

For folding mathematical and matrix functions, type:

helpspecfun

helpelmat

for sure.

Deyakі functions, takі yak sqrtі sin, - woke up. The stink is part of Matlab, the stink is even more effective, and the numerical details are more importantly available. At that hour yak іnshі functions, takі yak gammaі sinh, implemented in m-files. This can be done with a new code, if you need it, you can change it.

A decal of special functions set the value of constants, which often turns out to be:

The inability to appear in case of a change to zero, or in case of a mathematical virase, should be brought up to a re-adjustment, that is, to a re-replacement realmax. Not a number ( NaN) generated when the virases are calculated in the type 0/0 abo Inf/ Inf, as there is a singular mathematical value.

The change of functions is not reserved, so you can change the meaning to a new one, for example:

eps = 1. e-6

cleareps

Vidnosini operators serve for the adjustment of two values, vectors, or matrices, all operators of the same may be of two different values ​​that are recorded, as shown in table. 3.

). In the middle of a zealous sign, it’s possible to visit a chemometrix, especially the MatLab package. Its popularity is superficially temporal. Let me explain to you that we will use MatLab to work hard on the universal processing of large-scale tributes. The very structure of the package is to rob it with a manual method of matrix calculation. The range of problems that can be sorted out behind the help of MatLab, I am looking for: matrix analysis, processing of signals and images, neuron framing and a lot of them. MatLab - tse mova viskogo rivnya, scho maє display code, yes yes you can let us know rozumіtisya on the programmed algorithms. The program is simple and easy to create, allowing you to easily create powerful algorithms. For the richness of the history of MatLab, a great number of functions and ToolBox (packages of specialized settings) have been installed. Popular є PLS ToolBox from Eigenvector Research, Inc.

1. Basic types

1.1. More robotized in the middle of MatLab

Start the program, click on the icon. Before you see the robochest of the middle, the image on the little one.

Robochest the middle MatLab 6.x Trochi are seen from the working middle of the front versions, there is a large handy interface for access to additional elements

Robochest the middle MatLab 6.x revenge such elements:

    the toolbar with buttons and a list to open;

    Launch Pad window Workspace You can adjust access to the additional ToolBox modules and to the work center;

    in tabs Command Historyі Current Directory, it is intended for re-glancing and re-wiping of previously entered commands, as well as for setting the stream catalog;

    command window, in which there is a requested before input and a flashy vertical cursor;

    I will become a row.

I'm in the working middle MatLab 6.x vidsutni deyaki vikna, aiming at the little one, next to the View menu, vibrate the following points: Command Window, Command History, Current Directory, Workspase, Launch Pad.

The command should be recruited from the command prompt. The symbol ", which means requested before the introduction of the command row, does not need to be dialed. For a peek work area Manually vikoristovuvati smog scrolling or keys Home, End, to move left or right, and PageUp, PageDown to move up the hill or down. As soon as you can read the command line to move the working area of ​​the command window, just click Enter.

It is important to remember that the number of commanders or the viraz is guilty of ending the onslaught of Enter in order for the MatLab program to show the command or to enumerate the viraz.

1.2. Easy calculation

Pick up from command line 1 + 2 and press Enter. As a result, the following is displayed in the MatLab command window:

Small. 2 Graphical representation of the method of the main components

How did MatLab crash? With a handful of won, she counted the sum 1 + 2, then she wrote down the result with a special change ans and vivela її value, but it’s worth 3 in the team wіkno. The lower display of the swaps is the command row with a blinking cursor, which means that MatLab is ready to be calculated. You can recruit new virazi in the command line that know their meaning. If it is necessary to advance the robot with an alternate viraz, for example, to count (1 + 2) /4.5, then it would be easier to speed up with an obvious result, which would be able to get into the change ans. Type ans / 4.5 (when dozens of fractions are introduced, a speck will appear) and natisnit Enter, Go

Small. 3 Graphical way of the main components

1.3. Vidlunnya teams

Visiting the skin command in MatLab supervising the moon. At the pointed sight, the butt - the end answer ans = 0.6667. Frequently, the moon is quicker to take away robots with programs and can be switched on. For tsiy, the team is guilty of ending up with a speck in a coma symbol. Forward

Small. 4 Butt introduced ScoresPCA

1.4. Preservation of the working center. MAT files

The easiest way to save all the meanings of the changes is to use the File menu, the Save Workspase As item. At the same time, the Save Workspase Variables dialog box appears, in which case the directory and the file are indicated. For promotions, you will be prompted to save the file from the work directory of the MatLab main directory. The program will save the results of the robots in the files with the extensions mat. Now you can close MatLab. In the offensive session of the robot for the update, the value of the change in saving the file after the additional menu item Open of the File menu. Now, the changes, the value of the last session, have become available again. Їx can be victorious in the newly introduced teams.

1.5. Magazine

MatLab has the ability to write down commands and results from a text file (keep a log of robots), so you can read it from a text editor. For a cob of keeping a log, serve the team diary... Yak command argument diary then send it to the file, in which there is a journal of the robot. Recorded commands and results and results will be recorded in the whole file, for example, the sequence of commands

to carry out such events:

    display log from file exampl-1.txt;

    zd_ysnyu calculation;

    save all changes from MAT files work-1.mat;

    save the log from the file exampl-1.txt from the work directory in the root directory of MatLab and close the MatLab;

Take a look at the file exampl-1.txt as a text editor. The file will have an offensive text:

a1 = 3;
a2 = 2.5;
a3 = a1 + a2

Save work-1
quit

1.6. Assistance system

MatLab prompts are displayed by clicking the Help Window option next to the Help menu or by pressing a button on the toolbar. Qia zh operation can be a viconan when typing a command helpwin... Type helpwin topic... We will give you the same information, like the help command, and the Windows interface will provide you with more connections with the help of additional updates. Vikoristovyuchi to the web-site of the company Math Works, you can go to the server of the company and to process the remaining information from food, how to refer you. You can familiarize yourself with new software products or find out about problems on the side of technical support.

2. Matrix

2.1. Scalari, vectors and matrices

MatLab has scalars, vectors and matrices. For the introduction of a scalar, it is enough to attribute the meaning of what is wicked, for example

Amazingly, MatLab is great and great letters, so p and P are great changes. For the introduction of arrays (vectors of matrices), place the elements at the square bow. So for the introduction of a vector-row with a size of 1 × 3, the command is victorious, in which elements of the row they appear with punctures or comas.

When the vector is introduced, the elements are added with a speck with a coma. For example,

Enter small ones beyond the size of the matrix manually directly from the command row. When the matrix is ​​introduced, it is possible to look at a vector -stovpez, a skin element of a є as a vector-row.

For a matrix can be interpreted as a row vector, a skin element as a vector.

2.2. Access to elements

Access to the elements of the matrices go for additional two indexes - the number of the row that is placed at the round bow, for example, the command B (2,3) sees the element of another row and the third hundred of the matrix B. To see the matrix from the matrix, either row next to one of the indexes of the matrix, the number of the hundred or the row of the matrix, and the first index is replaced by a two-speckled one. For example, we can write down another row of matrices і A у vector z

It is also possible to see the blocks of matrices behind an additional two-dots. For example, it is visible from the matrix P block of values ​​by color

If you need to look over the changes of the working middle, you need to type a command at the command row whos .

It can be seen that there is one scalar (p), some matrices (A, B, P, P1) and a row vector (z) in the work center.

2.3. Basic matrix operations

In case of victorious matrix operations, memory slides, for the addition of either an indication of the matrix, are responsible for one size, and when the number of hundreds of the first matrix is ​​multiplied, the number of rows in another matrix is ​​increased. Additional matrices, so the very numbers and vectors, go for additional signs plus and minus

and many - by the sign of the star *. Introduce a 3 × 2 matrix

Multiplying the matrix by the number can be used for an additional star, and multiplying by the number can be both right-handed and evil. Reducing a square matrix in several steps go to the auxiliary operator ^

Change the result by multiplying the matrix by itself.

2.4. Special type matrices

Storing a rectangular matrix with zeros zeros

One matrix folds behind additional functions eye

Matrix, which can be stacked from one, pretend to inherit the Wiklik function ones

MatLab provides the ability to store matrices with small numbers. The result of the function randє a matrix of numbers that are equally distributed between zero and one, and the functions randn- a matrix of numbers, distributed according to the normal law with zero mean and single variance.

Functions diag the form is a diagonal matrix from the vector, the elements of the diagonal are expanded.

2.5. Matrix calculation

MatLab revenge bezlich new functions to robots with matrices. So, for example, the transpose of a matrix is ​​followed by an additional apostrophe "

Znokhodzhennya ring matrix carried out for additional functions inv for square matrices

3.Integration of MatLab and Excel

The integration of MatLab and Excel allows the corystuvache Excel to be converted to the numerical functions of MatLab for processing data, calculating and visualizing the result. Nadbudova excllink.xla implements the extension of Excel capabilities. For the connection of MatLab and Excel, special functions are assigned.

3.1. Excel config

Before the time you set up Excel for a sleeping robot with MatLab, you should change, but Excel Link should enter before installed version MatLab. The exclink file in the main MatLab directory or in the toolbox directory has a file called excllink.xla. Run Excel and select Add-ins from the Tools menu. To see a dialogue window, to avenge information about the availability in the given moment of awakening. Vikoristovuchi Browse button, enter the path to the file excllink.xla. A row will appear in the list of prerequisites of the dialogue window Excel Link 2.0 for MatLab from the establishment of the ensign. Natisnit OK, nadbudova is required to be added to Excel.

To blast my respect, now in Excel is the Excel Link toolbar, where three buttons can be swapped: putmatrix, getmatrix, evalstring. The buttons implement the main tasks, it is necessary to interconnect between Excel and MatLab - exchange of matrix data, and display of MatLab commands from the middle of Excel. When you start Excel again, excllink.xla will be connected automatically.

Uzgojena Excel robot and MatLab can use more than a few installations, which are accepted in Excel for promises (but there can be no changes). From the Tools menu, go to the Options item, open the Options dialog box. Select the General tab and change the position of the R1C1 reference style, tobto. Intermediates are numbered A1, A2, etc. The editors' contribution is guilty of the provisions of the forefathers Move selection after Enter.

3.2. Exchanging data from MatLab and Excel

Start Excel, change it, check all the necessary adjustments as described in the front section (MatLab can be closed). Enter a matrix from A1 to C3 at the commerce site, to display dozens of signs, select the speck as shown in Excel.

To see on the archives the data of the company and to press the putmatrix button, Excel will appear in the window for updates about those that MatLab is not running. Check out OK, check out the MatLab screen.

There is an Excel dialog box with a row of introduced, we mean for the designation of the changeable working middle of MatLab, in the same way as the export of data from the Excel alternatives. Enter, for example, M and close the box behind the additional OK button. Go to the MatLab command window and switch over, but M has opened up in the working middle, and take revenge on the array three by three:

View the operations in MatLab with the M matrix, for example, zvernit її.

Viklik inv To use a matrix, such as a MatLab command, you can go directly from Excel. Pressing the evalstring button on the Excel Link panel, until the dialog box appears, type the MatLab command next to a row.

IM = inv (M).

The result is analogous to the otrimanimy pid hour of the vikonannya command in the middle of MatLab.

Turn to Excel, finish the flow of the A5 combo and press the getmatrix button. There is a dialog box next to the introduction, in which it is necessary to enter a change, which is imported to Excel. In this vipadku such a wicked є IM. Press OK, in the commercials from A5 to A7, the elements of the rotary matrix have been introduced.

Also, for the export of the matrix in MatLab, it is necessary to see the output of the Excel sheet, and for the import it is enough to add one combo, as it will be the top element of the array, which will be imported. Some of the elements will be recorded in the middle of the Arkush, as long as the array is expanded, rewriting the data that can be found in them, and that is why it will take care of the import of the array.

Digest descriptions by ourselves easy way I will exchange information between programs - these data can be stored in Excel, then exported to MatLab, processed there by a certain rank, and the result is imported into Excel. Koristuvach transfer data behind the additional buttons of the Excel Link toolbar. Information can be represented as matrices, tobto. rectangular area of ​​the working sheet. Rows, roztashovani in a row, abnormally, exported, apparently, in the vector - rows and vectors - in MatLab. Similarly, import and import vectors-rows and vectors-stovpts from Excel.

4. Programming

4.1. M-files

The robot from the MatLab command row cannot, as it is necessary to enter a lot of commands and often change. Leading the schooler for the help of the command diary That protection of the robotic middle of the trocha is to lie down to the robot. The best way to display MatLab groups of commands є vikoristannya M-files, in which it is possible to type commands, vikonuvati їkh all at once or in parts, zberigati from the file and vikoristovuvati nadalі. p align = "justify"> For robots with M-files, M-files editor. With this help, you can open up the power functions and victories, including the command window.

Open the File menu of the main MatLab window and in the New item, select the M-file item. The new file is displayed in the M-files editor window, which is displayed on a small screen.

There are two types of M-files in MatLab: file-programs ( Script M-Files), which reveals the sequence of commands, that file-function, ( Function M-Files), in which the functions are described, which begin with a koristuvach.

4.2. Program file

Pick up a team from the editor to produce two graphs on one graphical window

Save the file with mydemo.m in the work directory of the main MatLab directory by selecting the Save as item in the File menu of the editor. To run all the commands, go to the file, go to the Run item in the Debug menu. On the screen appear graphically Figure 1 revenge graphs of functions.

Command file-programs zd_ysnyuyut vivedennya at the command v_kno. For strangling vivodu slid complete command specks with a coma. Even when typing a pardon is broken, and MatLab cannot recognize a command, the commands are displayed until incorrectly entered, when a pardon is displayed in the command prompt.

Even more easily, as I have found an editor for M-files, є displaying a part of commands. Close the graphic Figure 1... See for the helper Misha, press the button to the left, or the keys with the arrows when the keys are pressed Shift, First select the command and display it from the Text item. Beast of respect, as for the graphical visitor, there is only one graph, which will be shown to the visitor: to the teams. Keep in mind that for viewing some of the commands you need to see and press the F9 key.

Okremі blocks to the M-file can be posted with comments, which are skipped when you click, or manually, when you have a robot with an M-file. Comments are repaired from the hull sign that is automatically seen in green color, for example:

To display the current M-file, go to the additional menu item Open of the File menu of the working middle or the M-files editor.

4.3. File function

The view of the file-program has been opened, since the last of the MatLab commands, there are no input and output arguments. To check numerical methods, when programing powerful additions from MatLab, it is necessary to add file-functions, as it is necessary to use the input arguments and to turn the result of the input into the output arguments. We pick up a set of simple attachments, which will allow the robot to see the robot with file-functions.

Carrying out the preprocessing of the data for the analysis of chemometrics is often stagnant. center... It is enough to write a file-function once, and then you need to do the centering. Open the M-file editor for the new file and type

The word function is in the first row of the file, where the file is to replace the file-function. The first row is the heading of the function, in which the list of input and output arguments is expanded. The application im'ya function centering has one input argument X and one output - Xc. For the title, there are comments, and then there are only functions (in this application it can be stored in two rows), de and numbered values. It is important to write down Xc when calculating the value. Do not forget to put a speck with a coma, so that you can keep the updated information on the screen. Now save the file to the workflow. Begrudgingly, select the Save item or Save as in the File menu until a dialog box appears to save the file, in the File name field which has the name centering. Do not change yo, save the file by the function of the file from the proponent!

Now the functional function can be victorious as it is, as it is, because it is a sin, cos that is. Viklik of the Vlast Functions can be accessed from the file-programs and from the іnshoї file-functions. Try to write a file-function yourself, like a matrix scale, tobto. the length of the skin stovpez by the value of the mean square output for the cim stovpez.

You can write a file-function from a set of input arguments, which can be expanded from the list through whom. You can also turn the function, turn the key value. For a large number of input arguments, one must reach the list of input arguments through a coma, and the list itself is at the square arches. A good butt є function, scho translate an hour, tasks in seconds, years, chilines and seconds.

When the file-function is wicked, it’s just about the input arguments;

4.4 Deleted graph

MatLab has a wide range of options for graphic image vectors that matrix, as well as for making comments and other graphs. Damo description of a number of important graphical functions.

Functions plot small forms, linked with input parameters, for example plot (y) a line-cut-line graph of depletion of elements y from all indexes. If two vectors are given as arguments, then plot (x, y) expands the graph of abundance y to x. For example, to induce the graph of the sin function in the interval from 0 to 2π,

The program prompted a graph of fallowness, which is displayed at the window Figure 1

MatLab automatically gives a skin graph of different colors (for a vignette of vipadks, if there is a corystuvach), which allows you to download the data.

Team hold on Allowing to add curves to the current graph. Functions subplot Allowing vivoditi without lich graphs in one window

4.5 Druk grafikiv

Print item on the File menu that command print Use MatLab Graphics Print Menu Team print I will avoid a great deal of numbness in the event of receiving tributes and allowing control over M-files. The result can be sent directly to the printer, vibrations for replies, or savings for a given file.

5. Apply the program

At a number of distributions, the most common algorithms have been established, so that it takes a long time to analyze the rich and historical tributes. It is seen as the simplest methods of reinterpreting the tribute center and scale, and algorithms for data analysis - PCA, PLS.

5.1. Center and scale

Often, for an hour, the analysis will need to readjust the data. Nybіlsh vikoristovuvanny methods of re-adaptation of the data є centering and scaling of skin wrinkles on a standard basis. Hovering over the function code for the center of the matrix. The one below is shown only the function code, yak scale Dani. Beast to respect, that the matrix is ​​maє buty centered

function Xs = scaling (X)
% scaling: output matrix is ​​Xs
% matrix X must be centered

Xs = X * inv (diag (std (X)));

% end of scaling

5.2. SVD / PCA

Naybilsh is a popular way of squeezing tribute from a large-scale analysis є Principal component method (PCA)... From the mathematical point of view PCA - the process of decomposition of the visual matrix X, tobto. a gift from the viglyad to two matrices Tі P

X = TP t + E

Matrix T be called a scores matrix, a matrix - a surplus matrix.

The easiest way to know the matrix Tі P- Vikoristovuvati SVD distribution through the standard MatLab function, called svd .

function = pcasvd (X)

Svd (X);
T = U * D;
P = V;

% end of pcasvd

5.3 PCA / NIPALS

To induce the PCA to use a recursive algorithm NIPALS, I will count one component on the skin. View Matrix X to transform (yak minimum - to center; div.) і to transform into a matrix E 0 , a= 0. Let's start the offensive algorithm.

t 2. p t = t t Ea / t t t 3. p = p / (p t p) ½ 4. t = Ea p / p t p 5. Change the value, if not, then go to 2

Pislya enumeration chargovy ( a th) component, vvazhamo ta=tі pa=p E a+1 = Eat p a on the a+1.

The code for the NIPALS algorithm can be written by the readers themselves; When opening PCA, you can enter the number of main components (change numberPC). If it’s not visible, if you need a component, then write in the command row = pcanipals (X) and then the program set the number of components equal to the smallest indicator in the size of the input matrix X.

function = pcanipals (X, numberPC)

% calculation of number of components
= size (X); P =; T =;

If lenfth (numberPC)> 0
pc = numberPC (1);
elseif (length (numberPC) == 0) & X_r< X_c
pc = X_r;
else
pc = X_c;
end;

for k = 1: pc
P1 = rand (X_c, 1); T1 = X * P1; d0 = T1 "* T1;
P1 = (T1 "* X / (T1" * T1)) "; P1 = P1 / norm (P1); T1 = X * P1; d = T1" * T1;

While d - d0> 0.0001;
P1 = (T1 "* X / (T1" * T1)); P1 = P1 / norm (P1); T1 = X * P1; d0 = T1 "* T1;
P1 = (T1 "* X / (T1" * T1)); P1 = P1 / norm (P1); T1 = X * P1; d = T1 "* T1;
end

X = X - T1 * P1; P = cat (1, P, P1 "); T =;
end

About calculating PCA for additional reason and Chemometrics it was told from the owner

5.4 PLS1

The most popular method for flexible calibration is the method of projection onto latent structures (PLS). In a whole method, a one-hour decomposition of the predictor matrix is ​​carried out. X that matrixes Y:

X=TP t + E Y=Uq t + F T=XW(P t W) –1

The projection will be grateful - so, how to maximize the correlation between the given vectors X-Rakhunkiv taі Y-Rakhunkiv ua... Yaksho block danih Y including the wedge of vidgukiv (tobto. K> 1), you can have two projections of financial data - PLS1 and PLS2. At the first vipad for cutaneous і from vіdgukіv y k there will be a projection space. At the same time and rakhunki T (U) that navantazhennya P (W, Q), to deposit the form of what you see. Tsey підхід called PLS1. For the PLS2 method, there will be only one projection space, which is the back of all types.

A detailed description of the PLS method is given in tsіy knizі To induce PLS1 to use a recursive algorithm. A selection of matrixes Xі Y center

= mc (X);
= mc (Y);

і the stench is transformed into a matrix E 0 that vector f 0 , a= 0. I will give them an offensive algorithm

1. w t = fa t E a 2. w = w / (w t w) ½ 3. t = Ea w 4. q = t t fa / t t t 5. u = qfa / q 2 6. p t = t t Ea / t t t

Pislya enumeration chargovy ( a th) component, vvazhamo ta=tі pa=p... Virahuvati surplus to remove the offensive components E a+1 = Eat p t і zasosuvat before them the same algorithm, replacing the index a on the a+1.

Hopefully the code of the tsy algorithm, taking from books

function = pls (x, y)
% PLS: calculates a PLS component.
% Output vectors є w, t, u, q і p.
%
% Choose a vector from y as starting vector u.

u = y (:, 1);

% The convergence criterion is set very high.
kri = 100;

% The commands from here to end are repeated until convergence.
while (kri> 1e - 10)

% Each starting vector u is saved as uold.
uold = u; w = (u "* x)"; w = w / norm (w);
t = x * w; q = (t "* y)" / (t "* t);
u = y * q / (q "* q);

% Convergence criterion є norm u-uold divided norm u.
kri = norm (uold - u) / norm (u);
end;

% After convergence, calculate p.
p = (t "* x)" / (t "* t);

% End of pls

About the payment of PLS1 for additional payment ChemometricsAdd In it was told by the owner Projection methods for Excel systems.

5.5 PLS2

For PLS2, the wiggle algorithm is as follows. A selection of matrixes Xі Y re-create (yak minimum - center; div.), and the stench is re-created on the matrix E 0 that F 0 , a= 0. This algorithm was given to them.

1. Vibrati cob vector u 2. w t = u t E a 3. w = w / (w t w) ½ 4. t = Ea w 5. q t = t t Fa / t t t 6. u = Fa q/ q t q 7. Change the value, if not, to be 2 8. p t = t t Ea / t t t

Pislya enumeration chargovy ( a th) PLS2 components are required: ta=t, pa=p, wa=w, ua=uі q a = q... Virahuvati surplus to remove the offensive components E a+1 = Eat p t i Fa +1 = F atq t і zasosuvat before them the same algorithm, replacing the index a on the a+1.

This is probably the code, which is also the reason for books.

function = plsr (x, y, a)
% PLS: calculates a PLS component.
% output matrices є W, T, U, Q and P.
% B contains the regression coefficients and SS the sums of
% squares for the residuals.
% a is the numbers of components.
%
% For components: use all commands to end.

For i = 1: a
% Calculate sum of squares. Vikoristannya functions ss.
sx =;
sy =;

% Use the function pls to calculate one component.
= pls (x, y);

% Calculate the residuals.
x = x - t * p ";
y = y - t * q ";

% Save the vectors in matrices.
W =;
T =;
U =;
Q =;
P =;
end;

% Calculate the regression coefficients after the loop.
B = W * inv (P "* W) * Q";

% Add the final residual SS to sum of squares vectors.
sx =;
sy =;

% Make a matrix thess vectors for X and Y.
SS =;

% Calculate the fraction of SS used.
= size (SS);
tt = (SS * diag (SS (1,:). ^ (- 1)) - ones (a, b)) * (-1)

% End of plsr

function = ss (x)
% SS: Enter the sum of squares from Matrix X.
%

ss = sum (sum (x. * x));
% End of ss

About the payment of PLS2 for additional payment ChemometricsAdd In it was told by the owner Projection methods for Excel systems.

Visnovok

MatLab is still a popular tool for data analysis. For the benefit of the experience, you can win up to a third of all the previous ones, while the Unsrambler program will be stuck at less than 16% of the total. The head part of MatLab є yoy price tag. Besides, MatLab is good for routine tasks. The visibility of interactive robbing him is not handy in the viconnia of the poshukovyh, pre-old days of new, undelivered arrays of tributes.

Get ready for the project - please, dyakuyu!
Read also
If the apple stops signing up for ios 10 If the apple stops signing up for ios 10 A look at the electronic vag Xiaomi Mi Smart Scale: a stitch behind you A look at the electronic vag Xiaomi Mi Smart Scale: a stitch behind you This is also a YouTube playlist and everything about new This is also a YouTube playlist and everything about new