Skip to main content

Posts

Showing posts with the label calculation

Rejecting the applications that are not fit using Matlab

Program Let us say that you have got a client who is a HR Manager of a company. Understand the situation below. The company has given a notification in a newspaper for an opening and around 10 people has turned up. The selection process was three stages out of which for two stages your client want you to sort out the applicants. In the first stage a question paper for 5 marks is given and in the second stage a question paper for 5 marks is given while third stage is interview. They store the marks of the candidates in a file which has the data which looks as follows: Id Number Paper 1 Paper 2 1 1.5317 4.6950 2 2.5425 4.3797 3 2.5539 2.7508 4 4.0881 3.1124 5 3.9742 2.9352 6 3.2216 1.0387 7 1.8930 1.5062 8 4.0579 2.3546 9 2.6641 1.1524 10 1.7536 4.2215 such that it h...

Creating Multiplication tables using Matlab

Program Write a program to generate Multiplication tables of a given number using Matlab. Also generate Multiplication table for all numbers at once, like the one below: Multiplication Table 20 x 20 To know more about the multiplication tables you can refer: Multiplication Table/Chart - Ncalculators Multiplication Table - Wikipedia Solution Program 1: We will ask the user to give input of a number. Then we will use a for loop to print out the multiplication table of the corresponding number.  Program 2: We will write a program using functions. Program 3: We will create 10x10 multiplication table using the solution given here: Stack Overflow . Program 4: Generate 10x10 multiplication table using the nested for loops. You can refer to the explanation section for better understanding of the program. Some of the concepts you need to know to solve this problem are as follows: 1) input function in Matlab 2) for loop in Matlab  - This website has a very goo...

Check whether if the flow is laminar, transitional or turbulent with reynolds numbers using Matlab

Problem Reynolds number is a dimensionless property, it is used to find the flow type of the fluid. This data is useful is Fluid Mechanics, Heat and Mass transfer and many other subjects. But for our discussion the user will enter the Reynold's number and we will determine the type of the flow using the table below. We will accomplish the task using Matlab. Flow Type Renolds Number(Re) Laminar Re< 2300 Transient 2300<Re<4000 Turbulent Re>4000 If you want to know more about Reynolds number then refer to the fo...

Find eccentricity and area of ellipse using Matlab

Problem Find the area and eccentricity of the ellipse using simple if else and also using functions in Matlab. The relations for eccentricity and area of ellipse are given below: Area of ellipse equation Eccentricity of ellipse formula To know more about ellipse you can see from here: 1) Math is fun 2) What is ellipse - cut-the-knot Solution As we have already seen many basic programs lets make this a little bit difficult about 0.1 star difficulty from other problems. Remember we are now not adding difficulty in the Matlab program but we are adding difficulty in terms of math. We will see more difficult problems in Matlab soon. Stay tuned for difficult problems. In this problems we will ask the user to give the value of a and b. Then we will check if the user has not entered any value of b less than zero. Because length cannot be negative. And similarly we will check if the user has not entered the value of a less than or equal to 0. Because as the given equat...

Volume of pyramid in using Matlab

Problem Write a script to calculate the volume of a pyramid, which is 1/3 * base * height,  where the base is length * width. Prompt the user to enter values for the length,  width, and height, and then calculate the volume of the pyramid. When the user  enters each value, he or she will then also be prompted for ‘i’ for inches or ‘c’ for  centimeters. (Note: 2.54 cm  = 1 inch.) The script should print the volume in cubic  inches with three decimal places. As an example, the output format will be: This program will calculate the volume of a pyramid. Enter the length of the base: 50 Is that i or c? i Enter the width of the base: 6 Is that i or c? c Enter the height: 4 Is that i or c? i The volume of the pyramid is xxx.xxx cubic inches. Solution This problem has been taken from the book A Practical introduction to Matlab by stormy Attaway . This is a must read book for Matlab programmers. This will make your path to success in Matlab easy and y...

Allot a grade for quiz using Matlab

Problem Write a program with Matlab to return the grade of the student if the marks are given as input. Letter Grade Marks S ≥  80 A 75 - 79 B 70 - 74 C 60 - 69 D 50 - 59 E 40 - 49 F ≤  39 Assume that the institution follows the above system for its grading and assume that the user will give only rounded number. Solve the above problem using if else and functions. To know more about grading systems all over the world then you can refer: 1) Grading system by country - wikipedia 2) Grading Numerology by Smith College Solution This program is very simple and you will only take the user input as we have done in our previous examples. Please go to Radius of Circle  to see many other basic problems simpler than this problem.  I suggest you that you will refer the program section first and try to understand the program and then refer the explanation section to find a detailed explanation of the program. Some of the concepts you need to know in ord...