Preview

System Simulation in Matlab/Simulink

Good Essays
Open Document
Open Document
1967 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
System Simulation in Matlab/Simulink
System Simulation in Matlab/Simulink
Exercise 1: Matlab part
1) Plot the function yx=2∙x-x2+sin(2∙x)∙cos⁡(x) function problem1 (x) y=2.*x-x.^2+sin(2.*x).*cos(x) plot(x,y,'r') end 2) Print n! from n=2 to 20

function problem2 for k=2:20 n=factorial(k) end

3) Make a function that calculates RSS for a give vector.

function [rss]=problem3(a) rss=sqrt(a*a'); end

4) Make a function that check to see if a number is a prime.

function problem4(n) flag=0; for k=[2:1:(n/2)] a=rem(n,k); if a==0 flag=1; end end if flag==1 disp ('Number is not prime'); else disp('Number is prime'); end

5) Calculate a 3-degree nominal to fit the following column.
M=[-0.447,1.978,3.11,5.25,5.02,4.66,4.01,4.58,3.45,5.35,9.22]
Plot the curve of the nomial with the discrete points in the same graph.

m=[-0.447,1.978,3.11,5.25,5.02,4.66,4.01,4.58,3.45,5.35,9.22]; x1=1:numel(m); p=polyfit(x1,m,3); x2=0:0.01:(numel(m)+1); f=polyval(p,x2); plot(x1,m,'ko',x2,f,'r-') legend('n column','3-degNom','location','Best') grid on

6) Plot the following function as follow.
Rasx=20+x12+x22-10(cos2πx1+cos2πx2)
x1 and x2 are from 0 to 4.

x=0:0.05:4; y=0:0.05:4; [x,y]=meshgrid(x,y); z=20+x.*x+y.*y-10*(cos(2*pi*x)+cos(2*pi*y)) surf(x,y,z) grid on

7) Given the matrix N and P as follow, N=124736278123179324191347 P=23193829125849228923414913362248

Please calculate the N+P, N-P, N*P and P*N.
Please calculate the inverse matrix and orthogonal matrix of N.

N=[1,24,7,36;
2,7,8,12;
3,17,9,32
4,19,13,47]
P=[23,19,38,29;
12,58,49,22;
89,23,41,49;
13,36,22,48]
sum=N+P dif=N-P mulN=N*P mulP=P*N inverse=inv(N) orthogonal=orth(N) RESULTS:

N =

1 24 7 36 2 7 8 12 3 17 9 32 4 19 13 47

P =

23 19 38 29 12 58 49 22 89 23 41 49 13 36 22 48

sum =

24 43 45 65

You May Also Find These Documents Helpful

  • Satisfactory Essays

    NT1210 Lab 1

    • 473 Words
    • 3 Pages

    = 1 + 2 + 0 + 0 + 16 + 32 + 64 = 115…

    • 473 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Continuing with the steps I noticed that the digits 9, 4, and 5 repeating. I tried a different 3 digit number and the same digits kept repeating. I continued with 4, 5, 6, 7 digit numbers to see if I could find other patterns. For 4 digit numbers 1, 4, 6, and 7 continued to repeat. In 5 digit numbers, 3, 4, 5, 6, and 9 repeated. For 6 digits, 0, 2, 4, 6, 7 and 8 repeated. And lastly for 7 digits, 2, 2, 4,5,6,8 and 9 repeated. I found that all of the repeating digits for 4 added up to 18, for 5 digit numbers the repeating numbers added up to 27 and for 7 digits the numbers repeating at up to 36. I saw that a pattern occurred with the sum of the digits because the sum increased by 9.18+9 is 27 and 27+9 is 36. We can infer that the sum of the 8 digits will be 45 based on the…

    • 412 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    In vial one, a wild type hyper female Drosophila and wild type mellow male Drosophila were crossed respectively to determine the dominant behavioural phenotype. The first reciprocal cross was then carried out in vial two to define whether or not the behavioural phenotype is x-linked recessive. According to the results obtained from vial one, when the wild type hyper female and wild type mellow male was crossed, the resulting offspring’s phenotypes were all wild type hyper. This cross shows that the hyper behavioral phenotype can be considered dominant in comparison to mellow.…

    • 771 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Eval-Sim

    • 1333 Words
    • 6 Pages

    I am sorry to hear about your situation when comparing your performance evaluations with your co worker. From what you have addressed, your supervisor is using the paired comparison method, which enables the more precise ranking method. For example, every trait (quantity of work, quality of work, etc.), you pair and compare every subordinate with every other subordinate. With this method comes some disadvantages, such as bias and leniency. In this predicament, your supervisor may be have been biased during the performance evaluation affecting the appraisal ratings you and your co worker received. If this is the case, I will speak directly to your supervisor and address the unfairness and appraisal problems present. Please allow…

    • 1333 Words
    • 6 Pages
    Satisfactory Essays
  • Satisfactory Essays

    AIB Simulation

    • 771 Words
    • 4 Pages

    Before starting this homework assignment, please review the AIB simulation in this week’s Lecture. This simulation will provide you with an understanding of how to create a network diagram, and how to do a forward and backward pass to determine the ES, LS, EF, LF and slack (float). You will also learn how to determine the duration of the project, and the critical path.…

    • 771 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    When I saw the problem, I first thought it was not going to be possible to solve. Meaning; that I would not solve this problem without more information. When I sent the cat over first the mouse and dog did not fight by their selves. Then whenever I sent the dog or mouse over, they would fight with the cat. I even thought about leaving the cat on the existing shore and trying to move the mouse and dog, and found that the cat fought with them there on the existing shore. My thoughts then were that there had to be a trick to this. I had a conceptual block and knew there was something else to the problem that was not mentioned in the writing [ (Morris & Maisto, 2002) ].…

    • 676 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    5.1 Simulation

    • 261 Words
    • 2 Pages

    To conduct the experiment, as a data set we used different videos from outdoor places which comprise of both normal and abnormal motions. The experimental results of one of the videos have been presented in figure 5.1-5.8. The video consists of 100 frames where both normal and abnormal motion exists.…

    • 261 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Mgmt 1001 Everest Simulation

    • 4867 Words
    • 20 Pages

    MGMT 1001 Assignment 2 – Report – 30% of Final Mark Course: MGMT 1001 Tutorial Time: Monday 2pm (M14A) Tutor’s Name: Victor Libdy Date: 17th May 2010 Report Focus: Write a report reflecting on your experiences of the Everest group simulation exercise this semester with reference to concepts and theories encountered in this course.…

    • 4867 Words
    • 20 Pages
    Satisfactory Essays
  • Better Essays

    Montecarlo Simulation

    • 3314 Words
    • 14 Pages

    RiskSim is a Monte Carlo Simulation add-in for Microsoft Excel 2000–2010 (Windows) and Microsoft Excel 2004 (Macintosh). RiskSim provides random number generator functions as inputs for your model, automates Monte Carlo simulation, and creates charts. Your spreadsheet model may include various uncontrollable uncertainties as input assumptions (e.g., demand for a new product, uncertain variable cost of production, competitor reaction), and you can use simulation to determine the uncertainty associated with the model's output (e.g., annual profit). RiskSim automates the simulation by trying hundreds of what-ifs consistent with your assessment of the uncertainties. To use RiskSim, you (1) (2) (3) (4) (5) (6) create a spreadsheet model optionally use SensIt to identify critical inputs enter one of RiskSim's fourteen random number generator functions in each input cell of your model in Excel 2007 or 2010, choose Add-Ins | Risk Simulation | One Output; in Excel 2003 and earlier versions, choose Tools | Risk Simulation | One Output from Excel's menu specify the model output cell and the number of what-if trials interpret RiskSim's histogram and cumulative distribution charts.…

    • 3314 Words
    • 14 Pages
    Better Essays
  • Good Essays

    Depreciation and Value

    • 1733 Words
    • 7 Pages

    i. After knee surgery, your trainer tells you to return to your jogging program slowly. He suggests jogging for 12 minute each day for the first week. Each week thereafter, he suggests that you increase that time by 6 minutes per day. How many weeks will it be before you are up to jogging 60 minutes per day?…

    • 1733 Words
    • 7 Pages
    Good Essays
  • Good Essays

    y1 = 1; y2 = 0; y3 = 0; y4 = 0; y5 = 0; Y = 0; y = 0;…

    • 846 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    simulation unisim

    • 1059 Words
    • 5 Pages

    Note: Optimization is not limited to this concept. It can be applied depending on the…

    • 1059 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    6/18/2012 Chapter 1: Ranil Montaril, MSECE INTRODUCTION TO MODELING AND SIMULATION CHAPTER OBJECTIVE     Introduce Modeling Introduce Simulation Develop an Appreciation for the Need for Simulation Develop Facility in Simulation Model Building 1 6/18/2012 WHAT IS A MODEL??? “A Representation of an object, a system, or an idea in some form other than that of the entity itself.”…

    • 901 Words
    • 4 Pages
    Satisfactory Essays
  • Powerful Essays

    Matlab Parallel Computing

    • 5168 Words
    • 21 Pages

    John Burkardt (ARC/ICAM) & Gene Cliff (AOE/ICAM) Virginia Tech .......... FDI Fall Short Course: Introduction to Parallel MATLAB at Virginia Tech http://people.sc.fsu.edu/∼burkardt/presentations/fdi matlab 2009.pdf .......... ARC: Advanced Research Computing AOE: Department of Aerospace and Ocean Engineering ICAM: Interdisciplinary Center for Applied Mathematics…

    • 5168 Words
    • 21 Pages
    Powerful Essays
  • Satisfactory Essays

    Bit-Sum Prime

    • 284 Words
    • 2 Pages

    Every student, who has learned programming, must have written a program to determine whether a given positive integer is a prime number. Basically in order to determine whether a positive integer n is prime, we search for any number in the range [2, n − 1] which can divide n. Some of you would have designed a slighly better implementation where you search √ for any divisor of n from the range [2, n ]. Does either of these two implementations correspond to an efficient algorithm ? Ponder over this question deeply. Let us try to design an efficient algorithm for a problem which looks as simple and innocent as the problem discussed above. First, we give a definition. Definition 1. A positive integer is said to be bit-sum prime if the sum of the bits in its binary representation is a prime number. For example 6(110), 14(1110) are bit-sum prime numbers, whereas 29(11101) is not a bit-sum prime number. Design and implement an algorithm which receives a 64-bit integer n and outputs the count of all the bit-sum prime numbers less than n. Test it for a really large number, for example, execute your algorithm for 123456789123456789. Hint: Your algorithm/program is NOT supposed to enumerate all the bit-sum prime numbers. Instead, it has to just report the count of all the bit-sum prime number. Hence the output will be just a single number. Notice that you will have to use clever programming skills also in this problem.…

    • 284 Words
    • 2 Pages
    Satisfactory Essays