Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

UNIVERSIDAD AUTÓNOMA DE NUEVO LEÓN

FACULTAD DE CIENCIAS QUÍMICAS


INGENIERÍA QUÍMICA
SCILAB

EXCERSICE 1.

The sinc function is used in many engineering applications, but especially in signal processing applications.
Unfortunately, there are two widely accepted definitions for this function:

sin ⁡( πx ) sin ⁡x
f 1 ( x )= ∧f 2 ( x )=
πx x

Both of these functions have an indeterminate form of 0/0 when x is equal to 0. In this case, L’Hopital’s theorem from
calculus can be used to prove that both functions are equal to 1 when x is equal to 0. For values of x not equal to 0,
these two functions have a similar form. The first function, f 1(x), crosses the x-axis when x is an integer; the second
function crosses the x-axis when x is a multiple of .

MATLAB does not include a sinc function. Assume that you would like to define a function called sinc1 that uses the first
definition, and a function called sinc2 that uses the second definition. Test your functions by calculating values of x from
-5 to +5, and plotting the results.

EXCERSICE 2.

The if statement is used most effectively when the input is a scalar. Create a function to determine performance quality
base on a quality score, assuming a single input to the function. The quality grades should be based on the following
criteria:

Quality Grade Score


A >= 90 to 100
B >= 80 and <90
C >= 70 and <80
D >= 60 and <70
F <60

EXCERSICE 3.

Write a script file to plot the function:


{
15 √ 4 x +10 x ≥9
y= 10 x +10 0 ≤ x <9
10 x< 0

for -5 ≤ x ≤ 30.

EXCERSICE 4.

Write a program in a script file that determines the real roots of a quadratic equation ax 2 + bx + c = 0 . Name the file
quadroots. When the file runs, it asks the user to enter the values of the constants a, b, and c. To calculate the roots of
the equation the program calculates the discriminant D, given by:

D = b2-4ac

If D > 0, the program displays message "The equation has two roots," and the roots are displayed in the next line.
If D = 0, the program displays message "The equation has one root," and the root is displayed in the next line.
If D < 0, the program displays message "The equation has no real roots."

Run the script file in the Scilab Console three times to obtain solutions to
the following three equations:

(a) 3x2+6x+3 = 0 (b) -3x2+4x-6 = 0 (c) -3x2+7x+5 = 0

You might also like