## Transcripts

1. Introduction to Scilab: A Free Alternative to MATLAB: Hello. I'm Dr Koop. And if you're looking for a free art initiative to my clip, you are at right place. In this short video I will introduce to you a sort Were card silent. Silom is a scientific competitions off fear which is an alternative promote like this software Waas dilated in 1990 I know it has been serving this activity can be such community for the last 28 years. I started losing sight lab in 2008 when I was doing my postdoc traitor The Ministry of Foster Nor Denial in UK and C stand for my control system are for no matter for my numerical competition problems. I used silent and I encourage my students to use silent, thes type of open source software. They offer some of that wanted Is Richard their propriety Contra prior art dog have, for example, transparency. The source school is visible to the community. Any developer, any programmer can hook into the source court. So it means that they can find the limitations of the software are if there any bus and they can fix them and the communities they supportive communities very supportive to other users and you can, you will find got off whatever you can get the answers to your problems. So similarly for the same reason. Enough transparency. This or fear also reliable. And because more eyes means that more or ability there, the bug's their limitations will be fixed, and this often are considered more secure. So for the last 10 years, the popularity of open source software is growing, and about one, you don't have to pay anything as you know that word. Maglev is a very expensive. So on the other hand side lab, you don't have to pay anything. So let me show you some of the features of the software. So let us foresee were Does Skylab stands in computational software, so there are two types of competition. A sort of symbolic computations, or fear and numerical computation sort. So in symbolic competition, variables are treated as symbols. They re manipulate variables with symbols, and we do not give any value to these variables. We can find the values off X Y u B just like in algebra. So therefore, these type of systems are sometimes also called computer algebra system because it's just as same as you are doing algebra with computers for scientific and engineering works. You need medical computation. Will. You can actually get decimal values for your variables. We have to use the medical computation if we're doing a scientific or engineering work. And if you look at the sort fear in symbolic computation. There are many software available to are very famous. One is mathematic and others m'appelle on the numerical computation. Matt Lab is the market leader. Math lab has millions of users in many universities and colleges. They have met lab and a lot of community. But maglev is appropriate. Actress off here is the commercial software, which is very expensive. And the second problem is that you cannot modify the court because you cannot see the source court off Matt let while in Silom s. I live in the open source software. So the biggest I'd want it is that you don't have to be anything for these. And the second important thing is that you can modify the court horror you like. Both of the software can handle other programming languages, but in silence you can if you have some old programmed in returning for turn. R C. FORTRAN is or language, so you can put those cores into silence. You can integrate because you have the access to the Skylab. Sore scored. So this is a little competitive off the software. Let us see how it looks. It has a beautiful integrated development environment. You have a command prompt. You have a command history window and other windows just like Matt Lab. You can either run the internal function using the command. Prompt as you do in mad lib are you can write your own program. And in order to write a program, you can use the internal editor card signed notes, which can be as to accept from the left top corner. And you can if you have programs little, some various you can copy paste. Then you can save and run the program, and it will show you the graphs. And if you want to you you can also use the North paired very right and savor program and then execute it from the command. Prompt. No, we look at some of the computations which can be performed in Silom. It is impossible to mention everything here, but I have highlighted some off them. You can perform our types off arithmetic operations. Yeah, brick and marches operations. Inside lab, you can handle various types of Marxism, urges of reunion complex numbers. Marches of additional numbers emerges off strings just like sentences and also the merges off polynomial. So these are all the types of mercy which you can use here. Then you can generate different types of two D and three D graphs in silent. You can also solve linear algebraic problems, numerous type of problems. Then you can also solve differential equations in silence. If you have the initial conditions that really work to you. As far as cartel is concerned, you can get the time and frequency response of control system. You can plot root locus diagrams, board deplored and Nichols diagrams. Then you can also perform in America integration, and you can also have a lot of variety off block diagrams. More. We talk about the last two points, the block diagrams and the simulation. So you might be wondering that whether Silom has something similar toe singling off the medlab and the answer is yes, we have, which is card X course X causes similar to Similarly, it has a large library off block diagrams and it is very important for any numerical so fair to be ableto Cyma lit and model the hybrid type of dynamic systems and ex course can do this with the help of the block diagrams. So, no, I will show you the Palestra pH we have. So these are the palest which we have in X course. So it has a large library of pellets, and it covers all the signal processing control systems, electrical systems and mathematical computations. So all these type of competitions can be performed using these block background, you can model the system and then you can simulate it. And these air pellets are very good documented. You have, ah, help file available with give you the detail of the pillars. And if you click on any of the individual appellate, you can get the further details what parameters you have to put in this pillar. So this is a huge library, so you are able to model and simulate any type of dynamic system. So after this brief introduction, if you are in a research carrier, if you are in an academic scientific Terry here and you do medical competition, I might you to drive me inside the course. There is a tactic, 100% money back guarantee, so there is no reason to hesitate. So there are free preview producers are available. You can have a look at some of the reduced, and you can see where the discourses for you and just learned some new things and try making your own medical functions and Jordan America algorithms. So I hope that this short with you will help. You can encourage you to drive the course, and I will see you inside the course.
2. Introduction to the Scilab Environment: So once you have installed Silom, you can start Seiler by clicking on this island icon. And here you can see that side labor has started. So when you start Silom, you normally get these three windows. So on the left is the console window and on dried you have command history and variable Broza. So if you want to get rid of any of these windows, you can disclose it from there on the right to top right corner. And if you want to bring any of these windows back, you goto application meaning and then here you have variable brother command ISTEA and some other windows. So we bring commanding street and then in orderto dog this window inside console you have to click on this blue ish area and then you can bring it on the right side are horizontally as as you wish. So we will only use the command his Stephen door today. And in the next lecture, we will use the variable browser window as well. And as you can see, there are no options here at the top. You have to click on this console and you will get all these meanings back And there are some other windows like this X cause window signers might live to silo, asylum, translator and file browser as well. And we will talk about these windows in next lecture. But in this lecture, this was just a brief introduction. Ho toe, bring these windows and hope to remove them. And no, we will talk about how we can use silat too. Do calculations. So there are two men Ways toe do that one is using the command prompt. Just like Merkle ever and the other is to using the editor to write a program and then instituted the program. So on the left top. Under this file, you you have signed notes, which is the default editor of Silence. If you click on this, it will bring this editor here where you can write a program and then you can exit. Put it from here. But this we will discuss it. Maybe third lecture. So, for the time being, we're not using this silent because you're not writing program in this first lecture will only use the command prompt and see or to use the very able and how to assign them values. So I just closed this and no, we'll do some assignment. Variable well used to variable. So let's say that is a variable and it has a value off 10. So if we like equal standing commander prompt. So as you can see that the Skylab is has accorded are variable name and the value a equal stem. No, we can't have because 20 And we can add these two and story and see so Sequels A A plus B and no si has the value off 30. So we will talk about all the operators which are available in Silom later. But because the variable is the first thing you have to understand when you are programming in any language and the data types, so these two are the basic things which you have to understand first. So in the next election, we talk about what data types we have. But in this lecture, we will only see ho to assign values to variable in command, prompt and hope to make a variable permanent and a few other things. So, uh, no. We have three variables A, B and C. And if you want to see the value off any of these For example, if you just write a and enter, it will show you the value off air because still has the value off 10 inside lab No variable is permanent until you make it permanent. So at the time at the time being, for example, it has the value of 10. But if I sign equals five and enter No, he has the value five. And if I a type a no and enter it will show me the latest value off it. So the previous value has gone. So if you are doing long calculations and you you are using a couple of variables so there is a chance that you might overwrite your value the in the same variable. So for that reason, sometimes you have to make a variable permanent so that if you try to assign it a new will you the program will not let you do that. So how you define a variable as part minute. So for that we have a command which is card pretty deaf. So if I want toe have this a permanent variable, so I will type read f and then parentis is and in parentheses. In the quotation mark. I have to give the name of the variable. So it so if I do this, it will make a s permanent. And no if one if I want to change the value off a but before that because I want to write at the top. So if I want to clear this console, I have type CLC so it will clear the console and I can type it. No, again, no, As you can see, no has the value of five and I have made a as a permanent variable. So if I know want to change the variable off value off equals stand, for example, the program will show me this warning this domestic are you defining permanent variable? So it means I'm not able to redefine the value off it. I have b equals 20 and I can give beak was 30. No, because I have made be permanent before that. So it is. It is showing it? No. So let's say that I want to remove all the permanent variables so ho, I can do that. I can do that by using a command lead if and in the parentis is and in the quotation mark. I have to write a word clear. So no, it will create Clear all the permanent variable. So because I also have B is a permanent. So I'm not ableto do you define it And no, I can redefine a for example, a cost 300. No, I can do that. And, uh, similarly no, I can also redefine be as well because 400 with no problem. So in this way you can make variables permanent and you can clear it. So with a Pero, you can see your all your previous commands. So there were some other operators. We will have a separate lecture room operators but just a few of them you can for multiplication, for example. You want tomorrow to play A and B you use aesthetic. This is quite obvious. Similarly for division, if you want b equals be divided by a you can write the equals b slash it. And if you want Teoh a divided by B so you can also do that with a backslash. So if you type b Breck slash it so it will mean here do already, baby. So it will show you like this and you can have the value of B B is 400 and is 300. So you can see the difference between slash and backslash. So when I put slash b slash it means be do everybody and be back slash a means, Edward, it would be so we have to They're different variables for division. So these were some of the basic arithmetic operations in ah Silom and hold to adjust your windows or to make a variable permanent and hold toe. Remove the variable for on permanent status. No. One more thing I want to highlight in this luxuries. For example, I a sign of variable d equals a plus B and no, you can see that the console is equaling me The variable be If you don't want toe get the equal. Let me clear this first. If you don't want toe get the ICO, then you can write the equals a plus B and in a cynical if you put a semi colon, then the program will not show you the value off D. But it still has dif you press the type d and enter it will show you the value of deep. So in this way you can make it equal are you can stop the ego. So no leaders A Sinus string really variable. So, for example, s equals. If I want to assign any variable which has some characters A, B, C D or some sentence, then I have to put enough double quotation marks are a single quotation marble. Both are acceptable. So no s has the value off. Hello weren't so. You can also assign a variable with a single quotation marks and no, why has the value off How are you? So both matters. Single quotation marks are double quotation marks are acceptable to assign the string value to any variable. So no, you know that hard to assign string very variables are whole to assign numbers to variables ho To make them part minute and or to clear them you can also assign more than one very able simultaneous T, for example equals two comma big was three comma equals five. No, you can see that all these variables have been assigned the values If you want to clear the history Hey, Stephen Door Then you have toe right The set history reset history and it will clear the history window. As you can see and know in the next lecture, we will talk about data types and the variable browser.
3. Datatypes Variables And Constants In Scilab: inside left. We have a large variety of Richard pipes. Silom is matter type language, so you don't have to declare the type of data and you can Jane the type off any variable, the data type of any variable at random, where whenever you like during the execution of a program. But we have a large directly of the types, such as a double integer, both signed and unsigned indigenous of three sizes. Similarly, we have complex variables ah, bullion type to our force, then strings. Sparse matches can also be handled in silent. Similarly, you have a data type off which represent graphics, handles and functions, and this can also be made in China and also pointers. So this covers almost any situation in scientific are mathematical computation and we can have variables and we can make Maxie's of these data types whenever we need. These are six indigent types in silence. Ah, there are three sizes off Sinan Tages, which can store both positive and negative values. There are integers off a size one bite which are card in eight off to abide card in 16 and in Tages, off size for by our guard Inter to do. Similarly, there are two types off concerning teachers which can only start positive values. They have also the same three sizes. And sometimes when you're programming, you want to check the type of a variable before you proceed. So if you check a variable each other, type off into it. So by using a command which we will do shortly so you will get these values for in a time you will get really one. If you are checking a variable that the variable has this time so the program will return you will you want so similarly for other intelligent types, you will get these values if you check the type of a variable so it returns. If you get 12 it means the type of the variable is unsigned in teacher which has that provide size. So we will do this example shortly and you will understand it better. So no, we want to do some practice on variables. This is an introductory level practice, so we will do in dept. Things when we were doing the other programs. But at this stage, I want to show you how we can work with variables. So when we worked with very able. We want to see the data and the type and the size of the variables so that it can be achieved by using variable browse, which which you can see here in application. Erica, if you click on this variable browser, you will get this window. If you want to talk this window inside this console so you just click on this bluish area and you don't drag it and then you can put it anywhere you want. So I want to put this in this new street area. So no, you can see that here there are two tabs at the bottom. One is the news food which waas here before and know we have another term which is card variable growth. So in this tap, as you can see that there are two variables already stored here and you can see four different information about this variable. For example, the name of the variable is Airness Answer. This is their deferred variable inside the silent. It has a size off one into one and it has a type of string and its visibility is local. So this is a local variable, so we'll talk about local and global later. So local has a smaller scope and global variable has a bigger school. So we will discuss this later. By addition state I want to show you a few things that inside them you don't have to declare any very But for example, if you want toe have X off type double so you don't have to declare acceptable. You can state away give anywhere to two X So I have a signed X equals one. So I am storing the number one in X. So by default the data type off any variable is doubles. As you can see here on the right hand side that this X is no off type double. So this is there the fire type. So if I want this extra, be off in eight time, so one bite into indigent outsize one. But so what I would do, I say X equals in each. And then I assigned the value for his number two. And no, if you see here that you can see that know the type off axis individual it similarly you can assign into just 16 are interject 32. If you want to store our largest size of indigent. And no, as I mentioned earlier, that if I want to check the variable X at this sustains what is the type of variable X? So, for example, I don't know What is the type of you galex an hour to check it so true that this bullet and inside the display I really in type and in in type I will put the variable name which they want to check the type So I will give this Come on this day Spmeans display it and this is the command in tight What in digit type The variable X has this I want to check So if I don't know so it will return me one as I mentioned earlier there Do we get this value off one? If the entity type is in there too will get the rally off one. And if they digit type is interview to you will get the value of four. So let's change this XTO intelligence X equals it 32 And let's saying another value. I know we have X here, as you can see on the right now the type off excess indigent 32 if I want to check What? Well, you it has so if I used the same command off in type So the I s P means display in tight of the variable X and no, it is showing us the value food. So the dis command in tight command this is returning as the value for so four is means that this X is off today. So this is how it works. No, because if you want to change the type of the variable X, you don't have to declare a game. For example, if I assigned a stream value so I can say that X equals indistinct. For example, let's say help. No X has a value off string where you exodus two variables. So as you can see on the right invariable brother, the type of the X has changed. You just didn't all street. And if I have something Twix No. So, for example, if I had X less so, I want another sting, which is, let's say, work a space and work. And no, As you can see, the answer is hello work. Because I'm not assigning these summation of these two strings to any variable So therefore , the program is assigning this to a variable which is card in s. This is the before variable in silence. So if you don't assign any variable So the sister real assigned the value toe this very able which is in s which this is 34. And if you want to assign this whole, very able toe something, then you can forget the play. Want to sign this value to voice? Why will say, why equals Knicks unless and then a strength which is war and no If I entered know the value off Why is hello world And as you can see on the right side that a new variable has been till you too. Which is why which other type of string and which other size up one into one. So in this way you assign, you can see that what type is after variable is and how you assign values. So no, let's say that I want this way Toby again to any numbers. So I can say why he was too and all of a sudden, because you did the type of the variable is changed to double, which is there before type off numbers. And no, if we add one in tow this way, let's see what happens. Y plus one If you look at the right side Currently, this answer has a type of string sting. Because the last time ah, the system assigned were you to the answer. It was, ah, the value of hell. A war between a string which is a sentence. So therefore the type off answered stream. But no, If I put y plus one and I don't assign y plus one toe any very so what the program will do , it will assign this will you to the very year. But answer and no if I entered. As you can see, the answer is three and no. On the right hand side, you can see that the type of answer has changed from string to double because no, this tree there double value. So this is how variables are assigned reassigned values to variable at their types change, depending on the type of the value, which we're assigning toe these variables. So let us say that we want to clear this all these variables way have make made a mess or something. And there's a lot of variables we don't want. They want to clear it. So the command is just clear. So when you enter, clear all the variables will be clear from the variable Broza. And if you want to clear this console, you just put CLC so this will be cleared again. No, you only have this command prompt. Let us talk about the naming and never got the variables and some constants. So you can name anywhere able off upto 24 connectors so you can use letters and numbers and the combinations and lots of some special characters. And you can get a list from Silent Mental what letters you can use and but only 24 characters. 24 initial characters will be considered as the name of a very able and the rest will be ignored. These have the constants which which have been defined in silence and you cannot lose them . For example, this Pipo, which is 22 word over seven. So you cannot use this percent by in your variable names. Similarly percent eyes the iota to used in complex numbers. So this is a sequel to Underwood Square root of minus one. So this is defined as percent I similarly this is person is the base of the natural located So which is 2.7? They have something like this and in percent again If is the infinity this is the symbol for infinity. This you cannot reuse the variable name. This person is crew true bullion True So you can't use it Similarly percent every 1,000,000,000 falls so you cannot lose this as well. This name is denoted by not a number. Ah, As you know, in mathematics we used this name, not a number and absolute. Similarly, this a person absolutely shows the maximum value for which one plus a plan is good one. So these are some off the constants you cannot use in your variable names. Otherwise you can name your variables However you like let us say we want to print the value off the base of the natural order to be so percent and it will show us the value of 2.71 it for iota which is the square root of minus one. It will just show I so it will not show the actual square root of minus one. But we'll just show high, but it will be treated as iota of it is square root of minus one and similarly, the infinity. It will show only a u N F. But it means infinity. And similarly, if you type GPS the absolute so it will show whatever is the value of our two needs to be proper minus 52 or whatever it is that where you off absolutely will show you in this format. So this is how you manipulate variables and constants in silence. We have looked at how the value of the variable can be changed from one day to try to another data type without declaring the variable and hope we use very yearbooks, insider.
4. Basics Of Matrices : Hello and welcome to this first section off this course. If you are familiar with the mattresses, you can skip this section. If you know what is a matter. Extend. What are the basic types of murders is and some basic commands inside live. I will not be showing many commands of Silom in this. In this first lecture, I will be just explaining some Find some key points about mattresses because Silom is based on mattresses. And if you do not have a solid foundation in Mattis is then you will be struggling in this course. For those who are very big donors who are not very much familiar. Maybe they have taken a course in matters for a very long time. So this section will be, ah, good and very quickly view. So let's get started. What is a Matics? Matics is simply an arrangement off numbers, so these numbers could be coming from any background information you might have. An excess shooter might have data. Some were stored in any database. But that's what the definition is concerned. Automatics is simply a table of numbers are you can see a to the area of numbers, so you can define a Matics however you like. No Matics is denoted by a square bracketed on both sides of numbers. And these numbers are card elements are entries offer metrics. So this is the Ruoff a magics. So this is a first row. This is second role and this is tired row. Similarly, these this is the first column and there are three columns. So there were elements of his eyes in a ruin in a column. And this is the gender description off our metrics. So we describe Matics generally in mathematics in this formation. So this means that Element A resides in first row and first called the first digit in the subscript shows than rolling with this element reserves and the second video it shows the corner, for example, this element is in second role and second column. So if a Matics has an equal number of rows and columns, for example, this Matics has three rows and three columns. So if the rules and columns are equal, then the Matics is card square metrics. And if this is not the case than the Matics is card rectangular metrics. This definition is important sometimes because these square Matic say are off much more interest for us, but we also use it. These rectangular Matics these are some of the key points about Mattis is the first thing. Is the order off a metrics? So order dramatics is simply described as the number of rows multiplied by the number of columns. So if a martick's has to grow and three columns, the order will be too much bread with three. If o Matics is square, you can say the school Matics off ordered three because the square metrics have bought number of rows and number of the call of the cool, so you can describe it with one number. So the second thing is element which are here have described Matics addition. So when we say Martick's addition and multiplication there some conditions for addition and marked applications. So for addition, the condition is that if you want to add to Martus is the both of both. Matics should have seen order, so if one Matics had has an order off to multiplied by three, the other Matics must be off the same order. They must not. It's not a requirement that they should be square metrics, but their order should be seen. So because each and every element off first, a metrics will be added to the corresponding element in the second murder tricks. No. When it comes to multiplication, there are two important points. The first important point is that multiplication off a would be A B is not necessarily in most of the cases, it's not equal toe be my depraved by A. These two are totally different situations, and sometimes a B is possible. But B is even not possible. So this is the first point and why it is so do toe the second point because the condition for multiplication is that if you are multiplying to Mattis is a and B the number of column of the first metrics which is occurring first, you see the number of columns off the first metrics must be equal to the number of rules off the second Matics. If you are getting a product of be multiplied by then you will see the columns off, see and rose off. You always see the columns of the first met. For example, this metrics This is a very interesting metrics, as you can see there dis Matics has four columns 1234 And this column has four rules. So if I want to march, apply a B. So how many columns? They have four. And how many rows be have for? So I can get this product and we will talk about this or to do the multiplication in the next lecture. But at this lecture is only we're looking at the conditions where the baby is possible are not No What about being in B? We have to look how many calls we have. We have only one column and how many rows here he have only one group. So be it is also possible. So in this situation, as you can see that a b and we both are possible for this type of Matics. And if a metrics has only one rule, it is also card aro metrics. It is also card Aro metrics are sometimes you can call it a row victor. Similarly, if a Matics is only of one call, you can call it column. Attics are calling Victor. So this row vector and this calling that can be multiplied in border action B and B. Other than that, if the board of the Matics. Our Squire Martus is off the same order. For example, three cross three or four crossword. Both are three Krusty Krusty. Then both can be more declared inboard direction. The next thing is a very simple concept. I wanted to highlight here that if you want to multiply your metrics with the constant value, so that is certain would be that this constant would be multiplied with each and every element of the metrics. Next thing is transposed off a metrics so transported for Matics, for example, ease and metrics. This is a murder takes a very simple martick's weren't 23 up to nine. So if you make first role as the first column and the second row of the second column and the third rule as 1/3 column, then the matters which you will get is car that transports off the metrics and this is denoted by a transport Are a dish are a prime whatever you call it. But this is another example of transport, as you can see that in this case we have our first martick's, which has has an ordered off to multiply before road and four column if you take the transpose of this metrics so the first row will become first column in the second row will become second column. No, the order will be foreign toe, so the order will be changed. So let us see whole. We can use our knowledge off. Mattis. Is that this estate in silence? So at this stage, we don't know much about Maxie's. But we know two things. One is that we know how to make a metrics. And the second thing is ho toe. What is that? Transports Automatic. So we will use these two things. So how to make a Matics in silence? So inside lab, for example, I want to make a Matics A which is which has three rows one through trees in the forest role for 56 and 77 89 in the third row. So I will do like this equals squared records. Then there are two ways. The first rays you make first element than space. Second elements based on element and semi colon toe ended the rule. Then the first element of the second Rose Bay secondary space tired element, then ender over the semi colon. And then seven spaces it space nine and closed the square bracket and we will get dramatics . So this is your one. Where to define a Matics? The second way to define a Matics is that you use oh my instead of space So it and would find less They were defined. B b equals, Let's see the same metrics. So one comma, two commas, 37 cooler, four comma five coma six m equals seven committed common nine and then closed the school record. So this is your Matics B because both metrics have seem order so we can add them. So let us say, sees there some soc was a plus B, so it will act the corresponding elements off both. Mattis is the first element in the first row, and first color will be added in faster and first call, So you will get to similarly to will be ready to do. You will get four and you can see that this medics can be formed. So this is the addition off both mantises? No. What about transport? Because we also know how to transpose dramatics. We have not learned the multiplication, but we know how to transpose a matrix. What is the transporter from Arctic. So let's make a transport. So for transport, the command is if you want to transpose Matics, you simply type a apostrophe and enter. And as you can see here, they're the first Rule off has become the first column of this transpose. And because we have not assigned an invariable toe this so this is stored in a variable answer. So if you want, for example, B s the apron metrics so you can say the equals a prime. No, you will get this Matics B. Which is the transports off Matics? A. So this is how you transpose a matrix. At this stage, we only have land. Sof s so much so. But there are many commands in silence which deal with the mattresses and which we will be learning in other next lectures.
5. Operations on Matrices: So let us talk about arithmetic operations in mattresses. Hope you already know. But for someone who is a big no fast, we talk about Matics addition so far. Matics Addition. The condition is that only the mattresses which have the same order. Tim Barrett, Rolling toe columnist. Order. So it means if I have to add Matics AveryD Matics B so the number of rows and columns off a should be equal to the number of rows and columns A B So how to perform the addition if, for example, sees the some off A and B So what we do we air. The corresponding element in both murders is so This is the element in the first row and first column off A, and this is the element in the first row. And first call them off B and that First, I would like to mention that the deserted metrics will also be having three rows and four columns. So whatever is the order of these two matches there. Some will also have the same order, So the corresponding element these two will be added and it will make the entry of the first rule and first column So this is the element at first row and first column off. See? So how we make this? We take the corresponding element from both mattresses and we share them together. Similarly, the second element, the second faster one second column will be made by taking the corresponding elements in both individual mattresses two and seven. We add them together and we make this element similar. Levy air Destry with zero. And we met the element off faster. Oh, and tired column off the desert and mattresses and the process goes on And you get that some off these two mattresses and no, you can simplify it. I'm not doing that. But you can do that. No letters do. Two examples off Mark Implication off Martus is, for example, if you want to multiply Matics every B, you are trying to get the product a B. So there are two ways you can multiply toe murders and be one is that you are looking for. A multi bread baby are the other ways you are looking for be multiplied by it. So, in this case, if you are for example, they were looking for hey, be the product a B of two mattresses. Then you have to see how many columns the first Matics have the columns of this matrix and you have to see the rose off this mystics. So how many columns has has four columns? 1234 The number of columns of air for a number of rows are br 123 and four So number of rows of br For If these two are equal, then you can get this broader baby. Only then if the columns are fast Matics which is occurring first the columns off a are equal to the Rosa beat and you can get the product of a B. So no, come toe this be so far, be a we have to look Roman columns be have. So this is a over B martick's. It has only one call. This is the only column a test. So number of columns are br one. And how many rows have because we always see the columns of the first doctoring first and the rules of the which is create a second so number off rose off. A number of rule of is only one because he has only one broke so It means the product B is also possible. No, What will be the order of the resulting? This is very convenient to know because if you know the order of the resultant in the beginning, then you will not do any mistake. So the order of the resultant will be rose off a multiplied by the columns off Be. So when we're checking the condition, we take the column of the first and Ruoff the second. But the order of the resultant would be the rule of the first multiplied by column off the second. So it means the answer off this product, baby, would be. The rules are Faeroes off is only one. So we just right here Order of the certain would be wonderful and how many columns we have . We have only one color. So our answer will be a metrics which has one into one means it has only one entry If we want to get the product be so we have a daughter of the desert. The answer The answer Martick's prime. It will be rose off br Harmonie Rose be has bs four rows, Rosa bees are four and harmony columns. He has columns are for he has four column 1234 So that the resulting metrics. If he get BSO, the resultant Matics will have the order off. Four multiplied by four. So it will be a huge metrics. So it means if you get be so be it would be a metrics which will have four rows and four columns like this 1234 and one through 34 So it means you have to find these 16 entries And because it is good to know in the beginning that home, any entries we are expecting so that you don't make any mistake. So this is how you find whether the metrics can be multiplied and what will be the order of the resulting No, Come toe this multiplication babies. Let's say we're doing a B so we know that how many columns they have. They have four columns Harmonie Rose be here. We have four rows. So a bika is possible. First, we check distinct that babies possible? No, you're multiplying because the order will be only one element. So how we get that element we multiply First row, this whole Ruoff a with first color in such a way that the corresponding elements are more deployed and all added together. So how we do that, we multiply 10. With this four, we multiply this. Then we multiplied this five with this minus fight. This is the corresponding element when we are talking about the rule of the first in the column off the second. Then we multiplied this with this and we act. Then we multiply this with this and we act So this is what we have done here. We multiplied standing toe four, the first of the road. For the first of the column, we added a second of the road to the second of the column. Then we added the third entry of the road to the third of the column and forth and T to the fourth of the column. We multiply the corresponding and is in the rose off first and the column of second, and we added all these entries. So we get only one value, which is the answer off A multiplied by B. So, no, let's stay home. We will find this b m not doing here, But let's say I hope we will get this entry so The easiest way to do this is what is the number off ruin column off the sentry This entries in Rule One Roy equals one column equals one. So you will take the first rule of be so fast through Arby's this four like MTI the color of the pen. So there you can understand. The first rule of be is this four. So what is occurring first Bees occurring first and is occurring last. So this entry is first ruin. First column. So we will take the first Ruoff a B and first column off A. Because we're trying to find the product. Be so the first rule off B is a four and the first column off is 10. So even multiply 10 with four and enter here, which is 40. So we will get this entry s 40. No, come toe this entry This entry has rule one but call him too. So the roll off this entries Let me write it here. This entry is in the row equals one and column equals two. So we will take the rule off the first matrix which is be so Vigil first row. So first rule of B means this 14 and second column off a second column off is five. So we've been multiply four with 545 20 we were, like 20 here. What? We should right here. So this anti what is the position of the sentry? This entries Rule number four and column number four. So, no, we have to decide Roe for Row four of the medics, which is occurring first, which is be So what is the row for A B? This is the row for a B two and we multiply it with column four off the automatics, which is occurring. Second column for off is four. So we might we multiply two into four, which is eight, and we write it here. So this is all you will feel all these entries. So this was a sink, a simple rumor row vector, and this was a corn vector, So there will be only one entry. But if the both have ah more than one columns and rows, then every entry will have to be fine like something like this. It should be similar to this because when you take that the rule of this martick's and you call them of this murder. You will get a whole bunch of numbers, so then you will do the corresponding entry. So let's take another example. This is a murderous multiplication. So we have a Martic say, which has order off to Rose and three columns of the order is to crush three. And we have another Matics B, which has three rows and two columns. So three into two is the order. Remember that when you writing in order, you always right row first. So when you you cannot, it's not a choice. Do I have to write role first and then the column in orderto see, rather A B is possible. What we see. We have to check the column of the first and the rule of the second if they are equal than it is possible. So how many Column has three columns, so column off Air three and the Rosa beer Also three. So, both a column off a and the rows A B R equals. So it means a B is possible. Let us first determine what is the order of a B, because it will make our life easy, and we will not do any mystic order of the product will be always equal to the number of rows off the first multiplied by the number of columns of the second. So the number of rows off a order will be the rules off a multiplied by columns are be because it is occurring first. So this is always like this. So how many? A rose has two rows and how many columns we have two. So it means that is our order. The resurrected Matic, the product of a B, will have an order off to multiplied by two. So this is our product, so know how to fill these metrics. So the first position is first rule and first column so fast roll off the first and first column of the second. So this is the first rule off the first, and this is the first column off the second. So for this entry, this a 11 which is the entry. This one is the first entry off the were deserted Matics. We have to pick so Ruoff the first and call them off the second. So no, we take the corresponding into multiple light to with one go into one then we multiplied for with three foreign to three. Then we multiplies six with five six foot five and we had them together for this position. This is the position sub scape oneto One toe means first rule of the medics which is entering first. We just a So we will take the same route for stroke and second column So fast row, second call of this is the second color. So what? We'll do too much played by 72 multiplied by 74 multiplied by three When were to play it by three. Then six multiplied by 16 months Dragged by what? And we share them together we get this entry It oneto No, it to one No see because we have checked the order first. No, we know they're only for charities in the product. So then we write the position of these entries. What is returning? Balloon is very important. You write this here so that you don't know Mistake This is the color number of the second This is the rule off the first row off the first rule off the first rule off the first. So no second entry. Second row off the 1st 2nd row is this and first column of the 2nd 1st column is this. Eight with one it with one No. Six with three six with three mortar plastics with three, then two with fight Prove it. Five. Air Together you get this entry nor the last entry second row off the first color. First metric second Ruoff A second column of B So second rule is this second column Abi's this So eight with seven you'd with seven six with 36 with three and two with one two with one Marty play and act together. Then you just simplify and you get the answer. So this is the only place where you take the column off the first metrics to check the a possibility. Whether you're able to Marty Player. Not so you can check the column of the first rule of the second. Otherwise, when you are doing the multiplication are when you are checking the order, you always take the rule of the first and the column of the second. So let us see. How can we multiplied? These murders is inside. Let so it's very simple and we have to first declare both martese So let us say our equals . As you can see over a the first rule is 246 So we say to space for space six semi colon in the second row is air 62 it space six space to and then square bracket close. So this is a work Matics eight automatics be is because 17 is the first rose once Pierce seven semicolon the second Roy's 33 So three spares trees the second row and then the third row is five months or five space. Once this is over Matics B So Matic seek was a more to plant by beings. We simply say starting me and we enter and we get the product. So it's very simple in a Seiler you just declared both Marxist and then aesthetic is the multiplication sign so similarly you can add with a plus sign. So I'm not gonna do that's very simple. So this is how you do the markets multiplication of inside that
6. Determinants of 2 x 2 and 3 x 3 matrices: In this video, we will learn a brief introduction toe 10 minutes and we will find the terminal itself or two by two and three by three metrics. So what is the determinant? Determine It is a scaling factor for the transformation described by the metrics. So this matrix can be used as a transformation. Transformation is basically useful concept for capital graphics. When you see the objects on moving are rotating scaling. So basically you are multiplying their position vectors with certain mattresses and with when you multiply any director with the metrics, you get a new vector, the new metrics so that Mertzes are said to be transforming the renal vectors. So let me give you a simple example. We have one point, which is a 34 So to the comma, four is the point on the graph. So taking this as a 00 So 34 means one toe, 33 in the x axis and one toe 34 in the y axis. So this is our point three comma four and no, let's see. I multiplied this point with the metrics, and the metrics I'm using is one zero zero and minus one if I multiply this 3434 is a vector. You can say that I can present this with a column vector like this. And if I multiplied this first we check whether it's multiply about two columns and two rows so we can get this multiplication in tow. Builders that this is a and this is B. The number of columns of air to number of rows are beer too, so we can multiply. So over a certain will be number of rows off this and number of columns of this so over his American will be Do you two rows into one column it means we have to interest. This is a worrier first entry, and this is a word second entry to see what we learn in our last lecture. So, no, we have to find everything. We just have to fill this empty. So what is the position of the sentry first rule and first column? So we will take foster off this and first column of this, and we multiplied the corresponding entries. One is multiplied by three and it was multiplied by four, which is zero. Then we add these two so three plus zero is three. So we get this entry years three. So know what we have here. This is the position of second ruined. First columns a second. Ruoff this with first column of this one so you don't multiplied by 30 and minus one, multiplied by forties minus four. So we get, we get over new metrics. New vector, you can say, because only one column. So we get the value three minus four. So if we plug this thing, this is also a point. If deplored, this three minus four. So this will be 123 and minus for in the way. 1234 So minus four years. So this is our new point three minus four. So this is an example of a transformation? No, this metrics is acting as a transformation as a linear transformation and what it is doing . It is simply mirroring this point about the X axis. You can see that this new point is just a reflection off this one. So this is a transformation. Whenever you rotate something whenever you scale something whenever you move, move anything so that that is that is called a transformation. So mattresses can act as a transformation. So when this transformation happens, sometimes the resultant directors are scaled up or don't so there could be a scaling factor involved in this transformation. And that is the value off the determinant of this matrix, which is acting other transformation. So this is what the definition of for determinate is. But because this is a sign value, so it can be negative, it can be zero for somebody some square mare to seize. The determinant is zero, and it can be positive. So no, the question is hard to find the determinant. So determinate is basically a number since there's a scaling factor. So it's a number assigned number so far to cross to metrics There determinant is denoted by these two were tickle bars. This is called a determinant off a But this does not mean that they're supported to value because usually this symbol is also used for the more Youlus are positive value. But here is it doesn't mean the positive here it means determinant off it. So as you can see that we first right don't like this, the same Matics is returning the determinant form. This is called the determinant form. And for to cross dramatic. The determined is obtained by multiplying the stagnant. And then we subject the stagnant. So the retirement will be called to two multiplied by six, minus four, multiplied by eight. So this is where we find the determinant off to crush two metrics. So, no, we will find the determinant off. Three cross three metrics. So for treacle, Astrometrics, you have to consider two important things. First is the checkered board sign Matics, which is shown here. This is the checkerboard side Matics. And that meeting you have toe recognize here is that this is a tree crashed thematics. And this is also a three crust three in the determinant form. So what is here is that we always start from a positive sign in this corner. So positive sign then, just like a checkerboard. We go toe like a black square and white squares off we go plus minus plus in every direction alternate. So this place is associated with this element. This minus is this and so on. And then the second thing is that we have to consider the submit tricks. So some arctic is different for each and every element and we will find it in a moment. Hold will find the semantics for any of these elements. So you don't have to find the somewhere ticks off all the elements you have to find some air takes off every anyone grow our anyone call him so you can. Normally we find the somewhere takes off only one draw the top row. But the good approaches trying to find out the somewhere tricks for the elements in which elements off a column or a row in which you have most zeros. So the preferable are the shortest would be to find some artists is for these three elements. So, for example, if you find the summer to seize of these three elements fund two and three then you will consider these three signs. If you find the summer theses off these three elements last 1123 Then you will consider these three signs with those sub mattresses. So, no, we will find that summer to seize. Okay, so let's say that we take the this element minus one. So the summer tricks off this for this element is our determinant are determined metrics in which you ignored the row in which thesis element exists and you ignore the corner. So we, as you can see, that I have great out this room and I have great out this column. So you ignored these toe. Ah, the row invidious element exists. And the column and whatever is left is your some metrics for this element. So So Matics for minus one is for my next role minus 41 and you write it in a determinant for so these four elements in the determinant form is the summer tricks for this element. And we need one more and that must be in the same room. So the 3rd 1 is ministry. So the summer ticks for minus trees ignoring this rule and ignoring this column. We're left with these four elements and this is the summer ticks for element minus three. So know you have some mattresses for three elements. So you need either one row are one column. So once you have these three some artists is and you know the checkerboard sign you are ready to find a determinate off this metrics. No, this is the last step. So we used these Destro. So what we do is these are the summer notices for these three elements. So the definite of this Matics equal to first element, multiplied by the corresponding sign from the checkerboard side metrics. So the corresponding sign is plus for this so minus one were deployed by the chorus warning sign from sign metrics and multiplied by the summer takes off this element. Then what is the sign of this minus? So the second element multiplied by its corresponding sign from here and were deployed by each summer tricks. Then the third element were deployed by the corresponding sign from the same metrics and multiplied buyers sub metrics. So this is the determinant off this Matics? No, these are the determinants over to into automatics, which we already know that the retirement of this will be one more depraved. Well, zero minus minus three more to Puerto minus two. But this is the last system. So we have this minus one here, minus one into plus is minus one. So X minus one. No, The determinant of this is one into four minus. This is the minus in the formula of retirement, Then these two elements, minus four and minus two Similarly, when you might play this plus two with this minus sign, you get minus two and then there determinant off this to Christo Metrics, which is zero multiplied by one, which is zero minus. These two minus tumor declared a minus three. Similarly, the third element and then what bred by plus sign is minus three. Then the determinant of this matters, which is minus four into zero, is zero in minus minus. Train before and you're simplify this and you get answer. No hope to find the determinant of this matrix using the silo. So it is very easy. But first we have to declare the metrics. So over there save over Matics is is a quote the fuss Troy's minus one tu minus three to minus one space to space minus T than seven cooling the second Roy zero for minus two. So zero space for space minus two semi equal. And the third row is minus three minus for one. So minus T space minus for space one Matics close and then And this is the world Matics E. So we confirm that this is same and then we find the determinant. So let's say that We want to store our determinant in a variable deep so B equals and then the command for their determine it and commanders B e t DT, and that in the parentheses, you put the name of the A metrics and then you just enter and it will give you the determinant of your metrics. So this was a brief introduction to determine it. So this is a property of the score metrics, and this is a very useful property. Has been just trying to solve some linear system. You have tow finding words, automatics. For that you need determine it. I'll go inside like you have commands for finding everything inwards and solving and other things. But you should be clear on the basic ideas that what is determining what is the importance of the detainment? So therefore, this introduction indirectly with you, Billy, help you understanding these concepts
7. Bar Graphs In Scilab: In this video, we will learn how to make bar graphs in silence. So bar graphs are very important when you're comparing our data over a longer period of time relatively longer period of time, for example, for a few months. So here we have a data for a hospital in which three childhood diseases we have and this data was collected for the six month of any year. We have data from January to June. For these three, disease is the number of cases for each disease which were brought to the hospital. So there are two types of bar graphs. One are card group, two bar graphs in which, for example, for generally, we will see three bars for these three diseases. Similarly, for February, we will see these three bar for these treatises separately and then straight bar graphs in which, for every month we will have one bar graph in which there will be three portions for this according to the size of this data. So let's see how we can make these graphs. So this riverside lips or the best practices toe start script for this. So I'm launching this side north, which is the deforested, so I just type it here. So first on over XX is we have months. So I will take a metrics. Are you can see elector for months, so months equal. And it's just six values Vector six entries. So this is a work months, Victor and for diseases every take a metrics with the name diseases which is equal to so no , I will just type automatic speak. I will miss the times I will fast forward that we do have you just put the interests here. So now we have made these two mattresses for months we have 1 to 6 at a distance of one. So one Colin one call in six and our diseases We have this metrics so because there are three diseases So after three entries we have a semi colon then the next three for the next month and then a semi colon on six times. So no, we have both values and know we're ready to make the bar graph. So the command is very simple, which is barred. And then you can months coma diseases and no, you can run this program see, even execute. And as you can see that it has shown us the bar graph for these diseases. Nor for every month we have three diseases for the second month entitlement to three different colors. So this is guard group arrangements. So there are two types off options we have one is a group and that the respect And in order to give that option, the stag one. We have to use this command with that tired with the comma. Because if we don't do this comma, then is taking the the fart option, which is the group adoption. So then you can hear type in a single quotation work staked. And no, it will show you the state graph. Run it again. Say when execute. And no, as you can see that, no, we have the stag option in which three diseases are stacked on top of each other. So because we have not diligent the previous figure, so therefore you can see on the back. So I just close this window and run it a game. And now you can see that we don't have that previous figure. Because if you don't close this so it will draw the graph on the same figure. No we have this tagged option and this looks better on No. For example, if you want to give a title of this graph and also a label X label, and also why label, so are in order to do that, let's say we want to put months here diseases here and here. We want to put there's a child Would data for three childhood diseases as a graph tighter so we can do this All this in a single command. You can do this separately like title and excited, but you can use only the X title command and X title command. You can handle all these three, I mean X label while able, and the graph tighter. So first you part of that graph titled Within the Double Quotation Marks. And, for example, our title is Deter for tea childhood diseases. This is a world graph tighter, and let's see where X label is. So we have to put a comma and then again, double quotation marks and there were X label is months you can put with other 17 for example, and then on the way exists, you can have diseases our disease guesses, So these are over labels X label while able, and the title of the craft will run it again. And no, we have You can see. Here, let me bring this on top. As you can see, we have the title of the graph X label and the white label. Now let's say that we want toe port legions here because there are three diseases, so we want to put their name here. So in order to do that, we can use a command, which is car religion. So legion. And you can assign any vector any variable if you want. For example, that's one something Legent. And then you start this apprentices and the parentheses you start. This is Ameritech's symbol. And then in this you can for three disease names. So because these are string values, so you have to put this single quotation are double quotation. So the first is sheikhoun books, and then you have to put a semicolon because we have three entries here. Then again, single quotation mark and lumps in semi colon start the string again and measles. So these are the three well used for our readings. No, we run it again. And as you can see that our legions are here. This is not looking good. So obstructing over graph. So there are a couple of options which you can see somewhere in the man will that I will put somewhere in in a chart. So those position values you can assign for example, three value to well, you so you can assign some position. Really, Based on those position value you can put in the left right corners that somewhere there but the best way which I normally want toe uses that I want to put this at my own choice wherever I want. So for that we have to use the option number five. So in this Legion command you can put a comma here and then you can take any variable. So equals plus equals fight. So this is the position variable. So five years the value five when you put five so it will allow you toe put this legend this box anywhere you want. So when I run this no, here, as you can see that it is it is a lying me toe for this legion anywhere I want. So this is the best place here, so I will just put it. So this is how you porta legend? No, these months are the values. 123456 So if you want toe put some January February like this, so then you have toe. Do this with at once properties off access so you can get access to those properties by taking a handle. And what is their handle? Handle is they are identifier for this diagram for this figure. So that is gonna handle. So you first get the handle in a variable and then with the help of the variable, you get access to the property. For example, this stick the stick is card ec sticks. So these a wreck sticks extinct, extinct. Txt. So we have ah, this property which is card X underscore picks and then 123 what is written here? This is the property, which is card x, tex dot labels. So you have to access that property and then you can mortify the value of those picks labels, and this is what we're going to do next. I hope to change this toe. I will make another video for at once graphics, But because we're doing this bar graphs. I want to finish this off. So after this, nothing is left. Then you can make any bar graph. So therefore, I want to cover this in this video as well. So it's a little bit offered, wants topic. So if you don't understand anything so there will be a separate would go for advanced graphics. So that there I will explain this again. So know, just quickly or toe do this in order to get access to the handle of this figure, we have the command D c A. That it's a function. So we want to store that will, you know, very solar say is a variable. And we said, You see again, I get carried taxes. This will give us access to the excess properties. And we have saved this in a variable it and no, we will manipulate property which is called X speaks dot labors, which is this one? 123456 written there. So instead of their we want toe right, some of the strings. So we will right? For example, generally J m Then we have to put a semi colon. God, this is the first entry, then February and then a semicolon and reported me on March Sammy Colon, a PR semi colon. And then you do so no, we want to do these six values for over X tex labels. So this is all we do that or we ran it again. As you can know, I have put it here. What? Anyway, as you can see that No, we have these labels. So this is it. I hope that this will help you make any types off bar graphs.
8. Solving Linear algebraic equations in Scilab: in this we do. We will learn hotel sold linear algebraic equations in Silom and generate a brick. Equations are very important, and these equations are not always just three questions. Sometimes in some applications you have true soul hundreds off equations simultaneously, and it is a very time consuming process. For example, in laser applications, the scientists who are working in laser feel they have to solve some equations, whichever hundreds off lines and hundreds of variables. And you have to find the values of these variables, which satisfy all of these equations. So it's a very lengthy process, and you have to write sometime. Very complex scored if you're working in other programming languages but in silence, it is very easy to solve any number off linear algebraic equations because of metrics based so fear. And this is the advantage of these computational medical competition software, such as Silom bare metal. I'm given to just a short example. Because the procedure is exactly the same. You just have toe make these mattresses a little bit bigger. Otherwise, the procedures seem so let's say that we have three questions. First of all, our task is to find the values of x one x two and x three Re satisfy all of these three questions. So this is the task for when we're solving the linear equations. These extra an extra extra could be x Y are, said our ABC Anything. Sometimes these equations are solvable, but sometimes if the questions are wrongly formulated, these equations were not be solvable. There is not any solution because there are conflicting statements. These equations can be written in a Matics form just like this, because, as you know the matter. Smart application if you multiply this matrix, because this Martic says a the first metrics, and then this is the Matics off variable, which is actually a vector a column vector. So this is over Matics X on the right. Inside whatever we have, that is also a vector, and that is called a martick's be. So if you multiply this matrix first row with first caller, you will get this equation and equal toe this and similarly second row with second column. You get this equation and tired roving third column. You get the last equation, so basically we're not changing anything. We're just writing these equations in these metrics for as you can see that if X equals B that it means X equals in once we know this is only possible if in words exist and in once only exists. If the determinant of the is not equal to zero, them in words exist. But if the determinant equal to zero, then in worse does not exist, we just write this Matics a and B and then we find then worse off in and multiply it would be and we will get a column. Attics and that column er ticks will have three entries anti number one, anti number two and anti number three. And if that Matics equals two X as you can see X so it means if that Matics is equal to X So what is X X is X one extrude and ex tree. So we will get this metrics by finding the inwards and multiplying it would be. We will get this matter and this market is equal to X. So it means when these dramatics are equal so they can only equal if the first entry is equal to the first entry, the second and physical toe, the second entry and the third entries equal to the third entry because you can only equate to matters is if every corresponding entry is same. So this is what the idea is. So simply find out the Matics of coefficients. This is also card Matics of coefficients because these are just the coefficients of this. If, for example, there is no extra you put a zero here. If this is a situation so you can put zero instead of if there is no But you have to write their questions in this proper form, X one is and on top of extra and his top of X one in all die questions If something is missing, you put a space here and put zero there. But you have to write them variable on top of each other so that you can far too late this metrics. If there for example 15 equally in and you make a mistake, then you're Matics will be wrong. Then you can just find the and worst of the mattress of coefficient and multiply it with this metrics on the right and you will get a metrics. And this matter will be equal to the size of this Matic. Both sides will be same. Of course it is excellent. You will get the same size metrics. So here I have made these two Marxists Martick's s So I just from the north paired. I copy this, medics, and putting this command prompt Mr Tear. So this is a Walmart takes a and we have to find the inward stuff a first have to find in worst of a first. So the command is in worse and then it I know this is in worse No, we defined the martick's be we just this one I just copy paste because I want to save Sometimes it's just best to cheers and no the somatic be Novi multiply in worse off a B. So we have not saved in worse avian any variable. So we have to write it again. So we have to multiply in worse off a multiplied by B and regardless metrics No, this my Texas over Martick's X This is our X one minus two. This is our X two, which is 15 and this is our ex tree 14 is very simple
9. Coding your own functions in Scilab: in this lesson, we will talk about functions inside. Functions are an important part off any programming language and there are many words. Are names used for essentially the same thing which are functions such a Some programming language called them sub rupees. They're also card procedures are my crews are supper grams all these keepers there essentially for the same purpose. So what functions do so? Functions are basically a piece off court court which we don't want to write again and again in larger program. So we write that piece of court once and then we call it in over men programs whenever we need. And we sent some variables to this court and then we get back certain variables from that court. So this is what the function too. So this piece of court is card function. So essentially, the functions are just a piece of court were very sensitive variables, and we manipulate those variables and then we get back whatever we want. Some of the examples could be like we sent two points to a function. The coordinators have two points and we get but the distance between these two points, so this could be a function that we send. Okay, this ever point x one y one And there is another point extra y toe. And we send these four coordinates to this piece of court and we get back the distance between these two points. Similarly, another example could be that there is a rectangle and we have two sides. For this is aside, air this aside be and we send these two side data Are these two variables to dysfunction and we get better area after triangle and as well as the parent very meter of the. So you can get through one value from a function you can get More than one were used from the function, so every language has certain built in functions. So similarly, Silom also has a lot of built in functions like square root, sign cause and tender tick limited functions. And what you give here is you give some variable any value for example X, and you get the square root of that value back. Similarly, these are the signal Matic functions very popular. You can get the maximum off any vector at any metrics. You can also get the absolute value, the positive value If you give a negative value here, you can get that the positivity similarly, in worst function is very common. You can use this to find and worse off. A metrics are in worse off a single number and there are many more functions. You tenet come. There are hundreds of functions inside lip. No. We will make two functions in silence. So the funds first function will take the card in itself two points B one and B two. So these four values x one. Why one and x two y two. We will send these value to the function and the function will return that stuff distance between these two points and the former owner of the distance as you already should know that for one of the distances x one minus extra holy square Unless why one minus? Why toe the square and this Underwood. So this is the distant formula. So the function will calculate the distance and returned back the distance. The second function we will be making here. And because this function returns us to values, so you will know hobo get one. Were you from a function are to value from the function So in this case we will send two sides off a rectangle toe dysfunction and it will calculate diarrhea by multiplying the two sides. So side one multiplied by side do. And it will also kill cleared the perimeter, which is basically side one plus side too. This is the formula for the periphery, perimeter of the rectangle multiplied by two. So the function will calculate these two value and return us. These two will you. So this is what we're going through court next. So another does make these functions. So first of all, we have to make the function for distance between two points. So we start over, ready to sign notes and we start with the keyword function. Function is the key word. And as soon as you press this space, the editor will show you disappear. Apprentices and a word and functions and function is the last word off your function. If you are returning only one where you can just right any name off the very able, for example, it. And if you are returning Borden one values, then you have to put in square brackets like this inside this and it's a good practice to use this square brackets anyway, even if it's not required for one variable, but you still use it. Then you say equals. And then you put the name off the very name of the function. For example, I want to write dysfunction as it capital distance slicks in these parentis is you have to put name off the variables, and the number off variables should be the same. But you want to send to the function. So in this case, we will be sending four variables X and Y coordinates off two points. So 61 calm away, one extra white. So you should select these names in a way that if someone else is looking at your court, they can guess what these values might be. So it's a good practice, but you can put any name here. It doesn't matter. I know we have to calculate this with variable A Are you can call it D because these more appropriate for distance B equals and no the for Mula Rescue party. And then you start the parentheses. And within this parentis is we have x one minus extra holy square. Means had to bless why one minus y toe head to So this is the formal off the distance and then a semi colon and your function is really this is the function very simple. Normally we use functions toe save over time when there is ah quite a bunch of court like 1500 lines which we don't want toe right again and again. So we write functions for that, but essentially you can put as many lines between function and and function as you like. This is just to give you hope. What is the Centex off a function in Siler? Because every language has a little bit different Centex So here the key points are that here, First of all, you have to write how many variables you want to return in this square brackets than equal time. And then name of the fund ship don't put equal after the name equals should be before the name off the function because we will be calling the function in this way distance and then we will be sending these four points and then whatever value is here that you will be calculating here so that this you want to return back this develop ureter. If you calculate something else here It's another name. Then it will not be returned. This is the Centex. So no, we have to save this first and then we have to execute dysfunction. So we save it save and, uh whatever it is that folder You You have to take note of this folder because when you execute, you have to give the full part off the file. So I give it the name, distance looking, put any name after file. But I will just keep the same name so distance. And then, as you can see, the extension is about a C. But this is only recommended. This is not compulsory. You can also use daughter s C R S C. I s right. And then you just save it and close this In order to execute, you have to get the full part upto the function file name with a command e x e C exact. And then you start apostrophe and then C colon. This is my part users and then the name of the function for you and then apostrophe clothes and then enter. So if you see function and your function command and then in front in it means there is no error are there is no warming. So sometimes you get warning when this function is already present and you try to redefine this function, then you get a warning here. So in that case, you should have a look that whether you really want to redefine our there is some problem so otherwise if nothing in the letter then it made the function has been successfully a combined no. You can use dysfunction however you like. So the only thing here is that the variable you are getting back should be here in your metrics, for example, I can say I can keep in a be any very willerson equals and I should be giving the function name and the same number of variables. So the stance and then so in order to check, I should first give a simple point first point. So 00 I think it's fine pointing the origin. And my second point is a 10 unit on the X axis and zero unit. Only way so clearly the district should be 10. So see where the program gives us 10 are not so as you can see that it gives the correct distance. No, you can check with another simple point and that it could be, for example, from region to treat runners on the X and four units on the way, because we know that if removed, three or next four envoy, then the distance should be five. And no, it is correct. So it means our function is working properly. No, we defined the second function. So sign Norse once again and you can cancel this because it's asking for the same function and know the second function is that we're sending two sides of a rectangle and we're getting to values. So again you start with the function and that's on you press space. It gives you these shootings no less. A. The poor Graham name is AP AP means area perimeter, and the values we're getting are too. So therefore, we have toe variables years or let's say A and P here we would be giving side one inside besides, and then we have to put an equal sign before the function name here, and then we can calculate E and P so it will be equal to the area side one. Marty belive beside two semi colon and the pyramid Very meter will be equal to too wordy, polite boy side one Plus I just have a look once again for the semi colon here and parentis is are correct And this multiplication sign should be there. Everything looks fine. So I just saved this see So no, I can put a different name like instead of a p. I put idea be the name of the function for area P. So save it, close it. And no, just the name of the function file, which is the idea we re enter. And again all commands were executed successfully, so it means we can use the function. Now this function is turning to values that we have to put two variables something like give me area and give me a perimeter. You can take any variable names equals Then we call the function And what was the function ? Name function name Is this a p? Not the filing, but the functioning So a p and then give you really or say four and five and enter. So don't regard this error. So why I regard this error? Because the p this is the function cannot find any variable. Be no, Here is the other. As you can see here that we should return to variables A and P But we're returning only the variable A So therefore the function is compiled successfully. But when we try to get the value from the function, the function is saying undefined variable Be because function will try to return the value be function cannot find any very will be inside the court. So it means this variable should be be because there is no beings at the function So therefore record this area so no, you can save again And no, as you can see because we have defined dysfunction before So it is showing us the warning. So this was the warning. I was talking about that if the function is already defined, it will only show you the warning that you are redefining the function. AP is the talk. Is it what you want? So there is no problem. So there is no error, only the warning. So no, we can execute it again with the same variables. Give me a give me p and if we enter, it gives us that pedometer and the video. So this is all you used the function and these air the warning in some common errors which you will get when you try to make functions. So the definition off every variable you are returning must be inside the court of the function. So that is it for the functions? No, you can define any function. The number off imports and the number of our force should be proper. And all variables which are out putting from the function must be defined inside the function.
10. Scilab For Control Systems Engineering: in this list and we will learn how to use Seiler for control systems engineering. And mainly we will be focusing on hold toe represent transfer function model and the state space model of control systems using the SILAPA. These are the two men representation off control system models when it's called transfer, function, representation and others card a state space mortar are the states press representation? So this is what our transfer from sheerness. So because we're mostly concerned, hope reviews or to make this transfer function using the silent commands. So we will not be discussing anything about the control system, but in few words, a transfer function is a relationship between the output of a system toe, the input of the system. This is a simple affection which has a numerator and the denominator. And this is in s domain. So as is a complex number, these are two Pollina meals, as you can see. So the rules off this party nominees are as hard to represent this transfer function this river discussing this lecture the second representation of control system. So these are two equations which are card stairs, space equations, and, uh, there are four matters is involved in this in these equations A, B, C and D. When we want to represent this control system in Silom, we can do that by putting the values of these mattresses and making the linear system from these murderous is so we can either make the linear system from pollen amuse, aren't we? Can make the linear system from these mattresses. And what are these matters is, as you can see, I have explained here that this metrics extort is a differential state vector and is called the system metrics. Similarly, this X is the state director, so basically, we have to choose some state variables when we are making a state space representation. So these variables ah, describe the state of the system, and these variables should be linearly independent and because we can select these variables at our own choice. So based on over selection, the stairs space representation of the system can change. So this desperate position is not unique. You can get different. Mattis is for the same system. That depends on how you choose these variables. You can see that you is they input to director and the bees dying. Put metric this column metrics, And we're mostly talking about single in poor single outpour system here. Then why is the output director and this be our the number off output variables? As I mentioned, a clear that we're talking about single input and single output systems. So they're also called Cisco Systems. So it means that our peas one so hard variable is one. And similarly, this D is called the feed forward metrics. So sometimes you you can state of a feed forward the tasa function off your component. But normally this makes the system unstable. So therefore feed for dramatics is normally not present. So in our case, we will take this as zero Matics and the order of this matter Texas, as you can see, is being toe m. So our bees one RM is also one because of the single input. So these days just an entry, a zero entry. So this is a system which I have shown you earlier on output and import relationship, that this is the transfer function of the system. And this is another representation which is the stairs representation. So we can easily convert between these two representation. You can go from transfer from chin to stare space and wise worse up. So I have converted this system this one into the states press representation. And these are my medicine, which I got. So these details I'm not showing here, but you can find it in any controlled system textbook, you can see that auto convert from transfer function to a state space representation. This is my metrics. A as you can see, really, this is my metrics be. And this is my metrics. See which I got from the systems. Both of these two systems represent exactly the same systems inside lab we have functions which can transfer this stuff for a fortune must express representation. It means that if we give the system this numerator and denominator are the transfer function the whole fraction. And we asked the asylum toe Give us these four mattresses Asyl every give us and definition is card transfer function to state space So e f and then two and then state space. So this is a function inside help which goes from transfer function to stare space. Similarly, if you want to go from States President presentation back to the transfer function so that function is card SS two. If so, using this month, you can go back. And as you might expect already, that when you're going from state space to transfer function, you have to give these four mattresses to silent. On this, we will show in a minute relief. You want to go from tosser function to state space. So you have to give this transfer function to silence dysfunction and it will give you these mattresses. And this is the purpose of this lecture to show you how you can make a transfer function for this particular system and how you can go from transfer function to stare space and from states pressed back toe transfer from ship. So since this is a way, want to check at every step. So I am not writing using the sign notes because I don't want this to be a function because we will be doing step by step. But later on, I will compile this. I will put in my course this whole program so you can run it as a function using this. I note we're since I want to explain a few things, so I will be doing this step by step so you can see that holding mega tartar function and hope we switched the from cross a function to stare space and back Before we start working on Silom, I want to show you that in order to make a linear system, there are three ways we can make a linear system. So the first way to make a linear system from the transfer function is let's say that we want to store the linear system in a variable s one. So this is a variable. You can take any name. So Cicely is the command s. Why, yes, l i n so linear system. So this is the command. And then in this command, you have to give first of all, a variable a collector variable which is called the domain variable. Whether it's a continues time, domain is discreet timeto and then you have to give the numerator after transfer friendship , which is a polynomial and then the denominator of the poorly NAMI, the nominator of the transfer function, which is also important. So this is the command which we will be using. But I want to explain this first. So this is the command this can have two values. Whether it can have a c corrector. So Siemens continues. Time are it can have ah di corrector and the means discreet. So we will be mostly using continues time. So no illuminated illuminated is a polynomial in s. In our case, it's off polynomial five s plus 10. So to make a polynomial, there is a variable r d fort variable are you can say Silom Constant s so percent s is available to us so we can define a polynomial in s by using this variable. So if you want toe, define a ball normally ness you can say that as equals percent is this is one way of doing this. So the other we have more. Making a polynomial is that you say as equals holy which is the command. And in bracket, you give a real number zero and then a character s elector s. So one way is doing this The other way is doing this and then you can be fined Apollinaris , for example. Your polynomial is B one, let's say and then you can say they're disputing equals. Then you can define like in our case, five s pillar stands so you can say five. Hysteric is lust in. So in this way I know you have the polynomial very able s so you can define a partner with any partner you can give any in him. Five X plus 10. So one way is this the other ways you just declared as like this and then you can define a Pordenone in this man. The second were to define a polynomial at the tired we actually the first is this. The second is just and the tired were to define a polynomial. Is this in this case You do find a pretty normal with s equals poorly the same Come on And then in the parentheses you put a metrics here, then coma then the s because this is a polynomial in s And then you can put two things Whether you can say that what you are putting here in this mattress metrics are the rules of this polynomial. Are there the coefficient of the board in Auriol So you can either put rules are you can put coefficient and we will be putting the coefficient because we know the coefficient is five and then this 10 is constant and Indus Matics What you do First you put the constant. So then is the constantly never kissed this one And then you put the coefficient off term s So if s he's ahead, dear. Then you can put the coffin of s if S is not there. You put zero dear So here we have as took off, you know offices five So we will put five year 10 and five will be a world new media Tripoli Normal. So we can instead of sp write it new director because of the new media Terri's five X plus 10 and our denominator porting normal. If we want to write, we can write over Denominator equals poorly the same command and our denominator has s four . So this is our denominated. Let me write it here. As for bless Go s Cube Bless s s going and plus five years plus 10 So this is our denominator. So these air ever coefficients And then we write coma and then we want to make this part normal in s then coma and we are taking the coefficients and this will be over or you know we're so then this will be their transfer function. And then you can use this transfer from Jim to find other things which you ruin control systems like you can find the step response off this transfer function, you can find the root locus of the starter function. So this you can do I could show you how to find a step response, but we will not be going into the details. So these are the three ways to make the polynomial and we will be using to off them. So you can either use this command are you can't make this polynomial and you can straightaway used this polynomial and it works. In this way you can make their transfer fortune and no view making transfer function in silent. So first, we will make over media triple you know, meal. So I name it numb and equals two poorly. Then we start the parent disease. And then the metrics first reported the constant trump, which is 10. Then the coffee Jenoff s, which is five matter flows, coma s coma, and then coefficient. And no, this is over new media 10 plus five years or we make their denominator using the other matter which I explained to you which is I will first take the variable s so s equals. Really? What do you know me? Zero coma. So no, basically I have taken this variable s to make a polynomial And no, I can make up all the normal with the name off, you know, ministers or the n equals I know I can make the polynomial s for so s raised to the power four means head four as head for that's true multiplied by And don't forget to put more people You can put us Stormer to black by s que so had three because S s quite so That's had to let's five ist Let's fight this So five steady guests less than this is your illuminate reported normal. You know your transfer function equals what is the name of the variable for illuminated now rewarded by be you. But this is your transfer function. But no, I will show you how to block the step response. So in orderto plot, you need a time because you want to lower the step response against some time. Victor, take five seconds at step up. 105 Big was zero point from zero to you. Don't Colon at the interval of 05105 upto five seconds. So this is our P vector. In order to find the step response, we have to use a function C s I. And first we have to put what type of response we want. Step on impulse. So step then and then we have to pour their time Victor coma and then we have to put the name off the variable of the transfer function. So which is PF? We have bigger India. So no, If I enter, I get this time response the response of the system. So no. In orderto Plourde this step response, we can use blood story but because we have not taken this into any variable, you, as you can see that way, had directly using the functions of we have to take this in a very able So let us take that variable. Yes, one Yes, one equals and no, we can enter this. You know, we have this variable gs one which we can plot so we can blot gs one versus time and we will get the step response so we can use. Come on, polar Pootie and just blurt your time worse is G this one. So this is the time response of the system step response off the system in order to plot the root locus off this control system for which we have the transfer function. So the command, these events events and then we just pulled their conference and it will Plourde the A root locus off the system. And this is basically the part of the rules of the system, as again has changed the gain of the control system exchange. So I'm not explaining this, but this is where you get the root locus in control system. Even this the function and no, let us transfer over system from Tulsa function to state space. So we have over system in systems transfer function in this very ever DF. And let us say that we want to change this to state space. We will say assess over variable a new very, but you can put any name equals transfer, function toe dead space. This is the function we will be using. They re past this transfer function toe this very a dysfunction and it will give us the A B C D mattresses. So these are your aerobatics a Matics, B Arctic sea and medics d notice these one into 10 So these are the initial states, and we are taking all initial assuming all initial conditions of the system to be zero. So, no, we have our stairs placed representation in a variable card SS. So if we can work from SS back to transfer functions to see what you get. If you compare this with the figure, I show you earlier and you can see that dramatics, which I got from my calculation of my analytical method is different than the Matics a which we got from Siler. I have these entries. My understand minus five minus one man is too. While the Silom is giving us the Matics A which has a lot off entries and plus some very small into like this, just tender to remind a 60 because the stairs space representation off any system is not unique. So, no, we have our stairs store in this variable SS. So we want to go back to transfer function. The function for that is stare space to transfer function. We let's say every store this in a very able any variable. And we say there Trump State space to transfer foods. You go from state space to transfer from CNN. We passed over very about in which we have stared spreads data assess? No, as you can see that we get this with tasa function and this starts a function is different than what? From where we started. It looks similar, like s for S Cube is there as the square is there. But there is some other term, which is very similar terms. So we can clean this because these terms have no significance. We can clean this by using silent and the function for their days clean. So we clean and report this SS would be if inside that for good report this bracket so no, you can see that. No, we have the same. Exactly same transmission from where we started because no silent has cleaned all these little terms of no significance. So this is the way how you go from states. Presto. Transfer function. So the last thing you want to do is that we want to make this transfer function from these mattresses. We have a we have B, we have C and it would be zero. So can we make this transfer function from these mattresses? Because Okay, so asylum has given us different medicine But I got these mattresses exactly from this system. If I give these matters is to side there whether we get this transfer from Shimmer Not so. This is the last thing you want to check. So we will make this system by using this command. For example, any variable s one you can see s one an equal It'll again the same command Sister Lin, Linear system. But this time we will pass this linear system. Okay, It's continues time for C, then comma and no, we will pass these four Mattis is A B, C and B. So I love will give us a system a linear system. So this is over Martick's A and over Martick's bees at its peak and C equals asylum his case and still you have to check whether you are putting the capital are lower case letters . So this is your seat and big was just one entry 0 20 equals and no reports this system continuous time function and then we passed these Where to seek a me see and be so you can see there Silom has made this variable s one. So as you can see that no, we have created over s one the state's press wherever with our own metrics which we got from analytical method. And this market is different from which Skylab gave us a clear and no, we want to make the transfer function from this s one and see whether we get the exactly same talks to function or not. So we say assess toe here and we passed. This s one and no again, as you can see that regard some garbage so we can clean this and we say clean assists Do BF I know as you can see that we got exactly the same transfer function. So this shows that the state's plays representation of control system is not unique because we go to the same transfer function from two different state representation of the control system. So in this lesson, we learned how to make polynomial. So to make transfer function photo go from transfer function, representation toe state space representation and hope to go back from States place toe trance official representation. We also learned that the state's press representation is not unique and we also learned that when we go from states place to transfer function, there are some negligible small values with Skylab gives us and hope to clean those values and get the clean transfer function.
11. Plotting Graph of Functions in Scilab : In this video, we will make two graphs. So these are graphs off these functions function effects. So you can say that our ye's X Square plus two plus one is first function and this is our second function. And in this graph, we will learn a couple of things. First of all, how auto define X variable ho to define these functions hope to get the function values, then hope afloat, then hope watching these colors and photo change these line styles. And also, as you might have noticed, that Silom grafts don't to have phone size this big. So we will also be changing the phone size off XX is label Y X's label and also phone size off the figure itself. So then we will put our title toe this graph as well. So these are some of the things which we will be learning in this class without for their let's start. So, first of all, we have toe declare the variable X and as you can see here that our exes changing from minus 10 toe plus 10. So this is the range of X. We will define X first ofall. So inside left, we can define access X equals minus 10 within in cream mint off 0.1 record toe. So this is a work x variable. You can also write this in our function if you want, but I'm just using the command prompt so that I can explain the thing step by step. So the first function we have as you can see that our first function is F equals X squared plus two x plus one. We can say that our F one any variable is equal toe X squared plus two multiplied by X plus one. So know this F we get all the values over. Second function is we can say F two equals X squared minus two X minus one X is quiet excess to the power pool minus two Mart applied by X minus one. This is our second function. No, you floor the first function. So plot were using the plot command and the plot command is similar Are you can say closer to the matter? Let blood come on. So if you are coming from metal background so you will find this very similar. Otherwise, there another commands available in silent. So we plot ex forces F one. So, as you can see that regard this plot off our first function so similarly we can floor the second function first. And then we will change the attributes off this plot. So let us plot X. What's his f group? So no, we have our both floors yet, So no, we want to change the color off one toe, right? And also the line style. As you can see that ever Linus Stylists x, we're putting X at all the values which were protea. First we've finished with the plotting and then and then I will show you what line styles we have. So you can easily change the line style which want so no in orderto Plourde this X and this blue color what we have to do? We will use the same plot command again If you want. You can just close this window so we can close this window so that we get the new window. So we use the plot command Xcor, my one No! We will give 1/3 variable here and which is Ah, string tribe. So we have toe start the apostrophe and the X dash. And then color is red. Let me see whether which killer we have in our example. So over plus function has blue color so we can put blue color with B And I will show you all the courts for this color dand and a post office close here. And if I plot no, As you can see, our first function has been plotted in blue are similarly we can floor the 2nd 1 Lord X coma F two coma X dash rent force trophy No, we have over both functions bloated one in blue and one in red No, we want to put our X label here, which is X value affects so that can be done in a couple of ways. You can bloat your ex label Why label and the title separately? But there is a command. We can do this together for you and we can use that command as well. So let's fast you do with the separate commands. So we say x label and then we just want to put X You don't want anything else in X labels or X is our ex Labour so know we have this excellent and here similarly, we can see why labeled and it way on way exists. We want to put FX of Xstrata string and effects. And when then we closed this string and no, we have our Y X rotated automatically So this rotation is automatic. No, If we compare with this, we still have to write this title a title you can write simply tighter and then you can again similar fashion graph or functions lose the string And now we have this tighter on. So we have to pour this legion. And in this legend, as you can see that we have statements like X X squared plus two x plus one. So for this we have toe right some mathematical equations and this we will be doing in our allegiance state. So you don't have toe actually store this in any variable. But I will just float in each one so that you might need this. It's one equals Legion Region is the command And inside this command we have to put a metrics here. We're having two legions, so it will be a metrics which will have two entries are two elements. So this is a metrics are row metrics reflector! This tour the string entries. So these this is the fastest ring, then comma. And then this is a second prof apostrophes. So you can right? First legion here, for example, F one and F two. I didn't just put a comma here. Better you poor semi colon Here Both ways are fine. You can put a comma. You can put a semi colon if I run this now. These are excess properties here. But there's nowhere. No, If you look here, we have this allegiance F one and f cool. So if you had no equations, you can state of the right religion like this and why the fire diligence will be placed on the top right corner. And I will show you how to change this position to any other corners. And no, we will write these equations and to write equations. This is the same statement Have to put $2 signs. I put $2 sign in both of the entries. So in this way, you don't do any mistake because this is a similar thing you're doing. So you do to both parts. So in the first you want to write excess squares X then hacked then square the last two X here. You don't have toe for the multiplication sign because we're not actually multiplying. You're just writing. So you just right toe X No hysteric here and plus one is the first function. So it will show you that, as you can see that at the bottom, it is showing you everything and no. In the second rewrite, gain extra square minus two weeks minus one. You put dollars saying, and in the dollars and you can write the equation, Aziz, Right in letting your family with later. So no, If they entered days, it will again show you access properties. And we will talk about this later. And no, as you can see that we have equations written here, so no, we want this to change from this tow. This position are probably this position. So for that, what you need to do, you can put 1/3 argument in this legion function. You can say that P. O. S position equals and let's say, said three. So there are a couple of positions available, so I think the three is bottom left our top left. So we will see what position disease So just enter this and all. You can see that the position three is I bottom left or position to could be this one, so you can try with this. But the best way which I like to do, is by using a position five. Because Position Five gives you the option to put it wherever you like. Because sometime in graft, you don't have an appropriate position in the corner. So you want to put in the middle? Are at the top off the figure, for example. So in that case, you can use position five. So let us use position five. Now, when I opened the graph, it is waiting for me toe klik somewhere because no, I have this attached with my mouth the legion box. So wherever you want, you can put it. No. The last thing. As you can see that we have to increase the phone size to increase the phone size we have to use a handle. Variable toe handle means the identifier off any figure. So any figure has an identified so that identify it is card handed, so we will store that handle in a variable and then we will access access properties using that variable. So let us say that is the variable in which you want to store the handle of this figure. So to exist, the handle I can say GC is the Camargue. Get current taxes and no, we have handed. So, no, we have access to all the excess properties. So no, you have to know what property. What is the name of the variables defined in silent for that particular property. So there is a list off properties available. So you have to check in documentation, for example, for four size. So let me show you how to change the phone site. Home sizes are available from 1 to 10. So one is the smallest and is the largest. So by the fire, it I think it is too. So I want to make it four. So how will I do that? I will just say a door phone size and phoned them. Underscore Size. This this is the way you will write. That you cannot change is because this is defined in silence like this. So you have to change a door. Phone size equals four, for example. And no, if I look at the figure, you can see that the four size of the figure has changed. No, I want her phone size off this title to be changed and also the X and Y labels to be changed. So to change the X label phone size, you will say a short ex underscored level, and then you will put dot and then four size, just like before. So you have to put a phone size. So let us change the way the similar fashion. Let me clear this. We can change the way in a similar freshened instead of X label before. Why label you can against a a door tighter thought phone Saiz was, Let's say six. And as you can see that our phone toe say that changed. No, the legions are not looking good here. We can use position five to put in the middle. And no, as you can see that this is busy signals. So it means there is waiting for us to go to the figure and place the Allegiant. So we go to the figure and replace it. So no, as you can see that, No, it is done. It is exactly the same which we wanted. These are some of the lines, styles and colors available in Silom. So we have used this one across. But you can use any of these for solid line. You have this dash similarly colon for daughter line and so on. All these options are available. So in the next floating lecture we will see how we can modify these distances, these air card EC sticks and we will learn how to modify these and hold to put other values a year. And we will be using trig pneumatic functions to do that.
12. Using Latex Commands on Graphs in Scilab: in this video, we will be plotting their signal Matic functions. There will be one more revenue on plotting that will be on bar graph Then these three videos will be enough for you to get started with plotting in silence. In this video, you will learn a few more things than the most important thing is the whole toe changed. Visa expects because here we will be plotting these two curves. And in this girls, as you can see, that one car is for sign effects and the other is cause affects. And we're plotting between minus two by the value off the excess minus two by which is the angle toe to point. So this is a range in which we applauding sign off X and cause effects. You should notice that the origin is here. So this is the This is the exception, you can say. And similarly, you can draw roughly the Y X is here. But because I wanted to show you hard to put these five values here. So therefore, I wanted this to be in a clear space, and it looks good in this way. Otherwise, zero is here, and, as you know, that sign and cause values change for a minus one plus one. Eso the values stay for any angle. The value of the court and signed stays between minus one plus one. So this is our range of Y X is and then you can actually shift these exes from here toe this place and at the end of the video, I will show you how to move. This exists from there to there as well. You can also move why exes toe this position and this we will do at the end of the video. But before that, we will learn how to change these values. So the important thing to note here is that that this is the zero value and, as you can say, their sign 00 but caused the Roy's one. So this is the value of the cause. Zero, which is one. And then this is the value off 90 degree. So at 90 degree, the causes zero and you can see here that this is bye bye to Piper to means 90 degree. So at 90 degree causes zero. But sign is no one. If you put angle from 0123 then it will be your radiant values. So one radiant equals toe approximately 57 dear. So but we wanted our ec sticks. Toby, based on this pie value because it looks good bye bye to minus piper toe So hard to change these air there takes values hard to put the pie values here and hope to put in a fraction where you see this is in a fraction. So we have done terms like excess square, but we have not done this fraction command. So I will show you how to pour these fractional values here. So the few things you will learning this So let's get started. First, we will define X as usual. So X equals minus two pi toe to fight so minus two multiplied by person pie which is the constant by this is our starting value. Then you can take any increments. So I will be taking one tent off the pie as a inclement because I want my ex ticks, Toby. In terms of pie, so 0.1 multiplied by percent by is my inclement and the final value is two multiplied by person pie. So this is the way we declared our X No f one is simply sign effects. So sign off X similarly F two equals cause a fix cause affects. And no, I will be showing you all the command which we have done in the previous video. So how to plot and how to change colors and hope to change phones. So all these command, as you can see here that you know how these commands work. I have put a title here x label while able. Then I gotta handle tow the figure. And then I joined the phone size and title, phone size and label phone site. So you know how this works we have done in previous. We do so I will not be doing again. I just copy paste this in the command with no and we get the graphs off. Both took pneumatic functions. So no, the only thing left is hope to change these pics value. At this we will learn no. So, in order to change these ticks values that there are two things basically one is the location and the other is the label. As you can see here that we want labels, these air car labels these are the locations these Air Carter locations. So we have toe both defined the location and the labels simultaneously in orderto wired any better. So this is the compulsory in silent that we define these things together. So how we do that there is. We have to put this in a list in which we have picks. We have the locations and re labels. So that is a very able, special type of very of other discard are you can say function, which is card the list. We say a your daughter is over handled toe. The figure EC speaks because we are changing their picks on XX is they don't extinct equals the list and in the D list. First we have to start and end this bracket. And then in here we have to start these square brackets. And in this square brackets, we have three things. Three string values. The first is card picks, coma and then locations. This is a string value and then a coma. And then we have labels. So these are the three things which we have to define. No. We put a comma here, and after the common, we start putting the values in the first bracket We have to put a bracket here. Apprentices in this parentis is we have toe defined the location off the picks. As you can see here that the distance between picks we have chosen his half point. So this is the zero take then. Bye bye to then. This is by then This is 1.5 pyre, 3.2 point and then to buy so half by is the distance So we have toe make nine ticks from their toe. The your labels and picks must match in this next Parentis is we will be declaring these positions denied these nine position just as we declared in X. So we said that we start from minus two, multiplied by percent by and we haven't inclement off this time. 0.5 more deployed by point. Because this is the in criminal previously forex, we have taken 0.1 of the piper no here, taking 0.5 by here. And then what is the final value? You put a colon here and then you put the final value which is two multiplied by by an always put a person before pipe. So I Mr person here, so percent by. So this is the way you define this middle parentis is. And then you put an apostrophe on top off this and then a coma. And then you put the final labour's know the label metrics. The level metrics should be started and stopped the square bracket. No, here we have to put nine labels. No, we have to put these nine labels starting from this site. These are kind of strings, but these things are arithmetic equation, so we have to put some later commands inside those strings. As we put in the previous lecture, we used excess square minus two extra use dollar sign. So we have to do the same. But this time one more thing we have to do, which is about the election. So let me show you hope we will be putting these a fraction. So inside their dollars side, we have to put a little command for let's say, minus to fight. So what we will do? We will simply say, minus toe and for Pailin letter, we use backslash and fight. So this is this is a command excellent by means Despite this one, this symbol point So this is not percent because percent by is the value off this point. But when we say backslash place so it means right down despite not the value but right down despite the only thing left is photo right This friction and we will write fraction with a command. Beck slash Frank. This is the fraction command and it has cooper. Antis is one for the numerator and one for the denominator. So you have to put a new military For example, if you want minus pi by to so you put up minus here then for pie you put backs less bite and for the denominator you put in this bracket so poop So this is how you put this value. This is the card later. Come on, this is another software. You want to learn this? I have a separate course for this. So this way we will be writing these nine variables in a work metrics. We will put $2 signs and in the dollar sign, we will write, for example, minus two backslash bite. So this is our first entry, nor we will put a comma and nor will put again quotation marks and in the quotation marks before dollar sign and in the dollar sign No, we will write the next, which is minus three bye bye to So we write that we write minus Then we can start fractions of backslash direction. And then because we weren't over minus sign it looks good, Toby, beside the fraction. So in the friction, then we have to pay it off curly brackets. In the first pair, we have three by so three backslash by This is a numerator and in their denominator we have only two. So this is our second label. So in the similar way we will write all goes nine labels. So I have written these 90 labour's because there's no point wasting time. So I will just put those nine levels and pasty tears and we will run it. So you know how you write this? No. So you have to separate all those with this And then you closed apprentices the starting one. These are the nine variables. So I just copy this and paste it here and I will paste this full statement here with nine variables. Separate plenty. But if you don't do any mistake off comma any silly mistakes. You will be fine. No, if you look at the figure no, you can see that we have these nine labours said here So this is what we wanted to know. The last thing left is the legions and we have a legion command. You have already learned this in the previous video I will put lived in command here and I will put the value five so that we can place it at our own choice. So enter these and no, you can say that Busy marks. We have to go to the figure and no, we can place it. So this is how you change the location and labels of these sticks. So whatever label you want, you can put it here. You can put the whole formula here if you want. No, the last thing we want toe do is to move the access. So XX is we can put it in the origin. So in order to do that we use the command the same figure handle a and a thought Expander scored location. This is the command X underscore. Location for XXY is in y underscore location for why exes and then equal toe, for example. I want to put their door edges, so I will type O r I g i and origin. So if I entered now? No. Our exes have moved to the origin along with the ticks. These are there takes and the labels. Everything is moved to the origin. So there are four positions for X axis. And those are origin middle, top and bottom. And there are four positions for why exes and those are left, right, middle and origin. So in X axis, we have bottom and top. And why exceeds? We have left and right, And you can move any of these excess with this command. So that is it for this review?
13. xcos: The graphical editor for modelling and simulation: side relation is a powerful tool for engineers. When they try to understand some dynamic systems, they usually model the systems, and then they simulated a system. Is any set off connected objects, which you want to study so it could be a few electrical companies? It could be a mix of electrical and mechanical components. Dissimulation is a a controllable experiment, which we performed on the model of the system. So this is how usually the simulation is defined just briefly. What is a model So more than when we say models? Our model is an approximation of the system because most of the real life systems are so complex. So what we do remodel the system with approximate mathematical models, and then we simulated. But it doesn't mean that you did a lot of mathematical knowledge. In Silom, we have a powerful simulator, just like sampling in matte lip. We have X cause in silence. It's a visual tour, so the modeling has been done inside the too, so you don't have toe have the mathematical knowledge of hotel model, a system you can state away used the blocks. So there are blocks for every company. For example, blocks for displaying their data blocks for reading, writing their data. So all these blocks their card, Alex, they're available in X course. You can use those blocks in order to start X scores, You write a command X close on the command, prompt and enter, and it will open these windows for you. So you better just at just these windows first so they don't overlap each other. Otherwise, where you go in one window, the other will be gone. These are the pellets. These are the blocks which are available in X cause, which we can use for modeling. So there are a huge number of blocks available. As you can see on the left, this is the list of the pillars available. And in this first lesson, we will use only two are three types off elements. And there will be two sources which we will be using and what our sources sources are from where we activate the blocks. For example, blocks Glocks, usually activated scopes are the displaced where we see the output off a system simulation , and similarly, the fights from where we read the data so similarly the input ports. So all these type of things are in sources. So instincts you have displaced and you can write data here you can write data are you can say the output pores are also available there also in sinks. So are put pours for writing data. So these type of things are available in these pellets. So explaining all this will take a lot of time. But there are little differences. For example, let's say that this is a single displace SCO. This is a martyr, part display scope. This is a floating point school. So these are little differences in all these. But we will be only using this single a scope single display scope from this is seeing section and from the sources section we will use disc lock. So currently we're not reading data from any five. We're not using any input pours from here. You only used this clock from here and then we use from things we used this display scope, single display scope and one more thing we will be using from source is this step input. Like most off other courses, we will also start over first example from our step input toe first order control system So for that we will use this a step and this clock. And there's from single you display. And then from the continues time system, we will use this transfer function block. So these four things we will use in this first lesson and we will only build a model of these. And in the next lesson, we will make the simulation because in simulation I have to explain certain other things. Otherwise, this video will be too long. So first of all, let's start from the transfer function block. So this is a dancer function blob. So click on this and then you can drag it here in the working window. So just released the most button and it will be placed here. No, we go to sinks and instincts. We need this single display scope and we drag it and we put it in front of here. Don't worry about the alignment. We can align it very easily later on then, from the sources we have to put putting for this a simulation step input to the system and I will explain a little bit. What is this step input and what is the first order system? Because if you don't know anything about these, Damn, it's harder to explain dissimulation. So therefore, I will take a few minutes to explain this first order system after I put all these blocks here and then we will simulate in our next lesson. So no, the last thing left is the clock. So we just put a clock here and now we have toe link all these components. Just let me explain that these red type off connections there activation connections, it means that some something is being activated from the other block. So in this case, this block is activating over display, and these are the input output connections. So this is important connection toe this transfer from ship block. And this is our connection to this transfer function. Block similarly, is a single import. Display it. So in order to connect, for example, let's start from the left state. When you over your most over these, it will become green. Then you press the left most pertinent and drag to the next connection. And when it becomes green, you release the button and it will be connected. No, you can click outside and it will be connected and similarly, you over over this. Then click the button directed the next connection. When it becomes green, release the bottom. Similarly, do it here and no, these are collected. No, we want to align these blocks. So the best way instead of you just try to align this. As you can see, there is hard to align because even if I try aligning, it will be very hard for me to do it like that. But the best way to light a select all these blocks and while keeping your most on any of these doors, right click and then into form eight. There is a line blocks and in the line blocks. These are different alignments available. So as you can see that we want this type of alignment, the middle alignment so that all blocks are horizontally in the middle. There are lines. So you just click on this and the blocks will be a line. Then you click somewhere else and it will. You are ready to see family. No, you can start the simulation here are you can change. You can set the perimeters of these components so the perimeters of these components can be set by going into firstly ground up my block. You want to set And in the simulation go to set up in set up when you go here. No, you can said these perimeters here. So for example, finally integration time means how long you want the simulation to run. 10 seconds. 30 seconds. 30 seconds. So you don't need to set any of these. But there are options available. For example, these are the solvers. These are the medical matters which the software will use to solve things block. So there are different values available. You can try different. And if you Ah, I want to go back to before you can press that before, For example, you go here, you use the rent Dakota method and then you come here. Then you want the d 41 Just click. Before that, it will be selected. Similarly, if you click on claw court assimilation and set up, then you can set the perimeters of these clock. In this way, you can set the perimeters. So for example, here instead of this one and one, if you want to pour some very for example, instead of what you want to put K in the numerator and some time in their denominator fast . You poor these by editing these blocks you put here in the new military. You put Kate, for example, and in the denominator, you can poop instead of one you can put be. And then after this, you can just go here and by clicking on this go here, set cortex and then you can assign the values toe does those K and, er whatever variables you are taking, you can assign values here. So in this way, you can do some perimeter setting and some value assignment. Two variables in this working window before we start a simulation, let me explain to you a little bit about what is this transfer function and what should be the response when we collect these three school for should we expect where should we? We're not. We're looking for here so that I will explain now. So this is the transfer function of the system. Faster function is the output of the system Do added by the input of the system in s domain . So as is the complex number and we cannot explain everything here. But let's say that this is the transfer function of your control system. So do you have a new military and you have a constant. So this new military, you can say it's a K A general form in the general form. It's a K at again of the system and this constant, you can say it. So when we say step input, it means we commanded the system toe goto. The value equals to one Is the unit step So one so system should follow over. Command and system should start from zero and it should reach the value off one because the system has some dynamics, so it cannot go straight of it. One like jumped from 0 to 1. So system will follow a certain part and it will reach the position one, so it will follow a car. So if you draw attention at the 10.0 off this curb, you will get the value off it. It is the reciprocal off the time constant. Are it'll also the initial slope off this car. So this is the first order systems first order system will go like this. The secondary system will not go like this. And when we say the first order system of second or the system. It means power of the S. If the maximum profit off as his one is a first order system. And what is the time? Constant? The time costing is the time in Mr System reaches 63% efforts final value. So the final value is one. So the 63% at 1.63 and if you drop it like here, you will see that this is 0.5 point five means one divided by two. This is two. So it means one body by a so that the constant the time constant of the system is the time in with the system, it is 63% efforts, final value and this better meat. It is very important because if you know the transfer function of any system, you can apply controlled fury and then you can say a lot about those system. Your understanding of that system becomes almost complete if you know the task perforation of the system. But the problem is finding a transfer function is not always easy because this transfer function comes from differential equations on go differential equations are hard to make So therefore there is another technique that is card system identification and in system identification, we we analyze the system using this car. If the system is following the curve which looks like a first order system, then we see OK, this is the car. And how can I get the value where the system is eating? 63% of the final value. So this is the plan constant of the system. Then we get the it. Then we see the the issue off this gate, where which is the final value. The final value is one which is the issue of this numerator with the constant K do everybody is one. So then we can actually identify the system we can identify means that we can get the transfer function of the system just by giving it a step input and looking at the response of the system, we can find the value off and we can find the value off key. And we can make this equation. We can make the terms of function equation and this is very important. And this tightening his car system identification. I'm not going into detail of system identification, but I'm just telling you that Why This kind of is so important. So no, let's take another example Where is different than a in this example, the transfer from 26 to a rowdy by s plus two. So no case changed Gay six, but is still to know the systems value. The final rally, which is gave everybody a 6 November two, is three No, the final value off the system mystery and the time constant is still the same. This is the step response off this transfer function. They plotted it for very longer time, as you can see, 100 seconds. But then I zoomed it and I just cropped the image and I cropped for only initial part of the email so that I can clearly show you otherwise. The car will not be very prominent. So no, let's say that we don't know anything. We don't know anything about this system. We only have discovered. So from this car we can find K, and we can find it by looking at the 63% of the final value and the final value itself. We can find a and E and then begins. We can find this equation, which is the transfer function of the system and no insulation. What we will do, we will take any transfer function. We really apply your step input and we will get this response. This is what we will be doing in our simulation in the next video.
14. xcos simulation: Step response of first order control system : So in this lesson, we will make over first simulation in X course. First, I want to show you the system. So this is our system. So we ever transfer function of two divided by hospitals to the same which we started before couple of 10. You should note here is that if you want to have a graph looking like this so the maximum time off circulation should be around three seconds. And similarly, the maximum value off the graph in the Y direction should be around 1.21 point three something like that, because these parameters we have toe set in scope and in a clock extra. So now let's start the simulation. So first we get the transfer function from this continuous time systems so you can just click here and then drag it similarly from sources. We need a clock and a step function. So this is a Glock. This is our step function and all. The last thing we needed, a scope pertinent sinks. So the single this place cooperative this one him? No, we just make connections and activation connection. You know, we align these blocks, align these work quickly, and no we have to set the perimeters. So first start from the school, so simulation set up, you can double click. So here the finally integration time the maximum time for the simulation, which is around three second, as you can see here. So we really just put a value of three, which is already I think, trees there. So today is this one. And in this we also have this. Why many moment? Why maximum? And because we're using the step functions a step function gives of one. So we need a little bit larger than one. So we can say that 1.2 and why minimum should be zero very fresh period. Should be. You can say to second with larger period 20 seconds. Okay, No clock. So here 0.1 is okay. Initialization time. You can change toe zero as well. So zero No, over. Transfer for Kinnick Stroh divided by X plus two. So we changed it to do you hear and no other step function. We want to apply the step function at zero. So therefore resected zero and the final value off the step is one initial there. Initial value zero in the final value off the step is wrong. So no, no, we're ready to apply the simulation. So just press this button start and as you can see, that it will show you the simulation. No, because over scale on the X axis is quite large. So this is the refresh time so we can reduce this a little bit so that we can get a similar looking graph. But if you just take a closer from here to, let's say at this point, so then you can see there couple girlfriends exactly the same. And if you see the 60% we'll use 63 is around here, probably. And if you drop particular, you will get exactly 0.5 2nd of time. So it means there because our is to. So this should be wonder. What about which is point for you. So this is all you, Simon late. So this was a basic simulation for a very simple transfer function, and you can do a little bit variation. For example, we're applying the stop step function here at zero. You can apply it at one with a delay of one second, so the graph would start from here so disclosed this. And no, if we apply this to step, time is one. For example, if you put one here and then we do the simulation again, As you can see that no over step function is applied at a time. One so it's a delay of one second. So you can just assume this click on left corner from where you want to do, and then the right bottom corner up to which point you want to assume. So now you can see that I was step function is applied time one. So you can change this little bit. You can tweak it. You can change the graph. You can move it as well if you want. So however you want, you can use the simulation and this figure and everything. So this is the V hobby. Make simulations the next course