Write a MATLAB function, called arbpoly, that computes a polynomial arbitrary nth degree. The function will take 2 inputs:
1) the first input will be a row vector, c, containing the coefficients of the polynomial, starting with the coefficient of the highest - degree term;
2) the second input will be a scalar, x, which is a real number at which the polynomial will be evaluated.
The function's only output, y, will be the scalar value of the polynomial computed at the value of input x.
In the body of your function, use vector(s), not loops, to evaluate the polynomial. MATLAB's function (length) will come in handy.
Note that script that calls/test the functions are already provided.
%script that calls/tests the function arbpoly
%tests 1-5 not random
c = [-2 0 3 -4 5 0 1];
x1 = -3;
z1 = arbpoly(c,x1)
c = [0 -3 1 4 0 1 -5];
x2 = 2;
z2 = arbpoly(c,x2)
c = [0 0 0 1];
x3 = -3;
z3 = arbpoly(c,x3)
c = [0 0];
x4 = 2;
z4 = arbpoly(c,x4)
c = [9 0 0 0];
x5 = 2;
z5 = arbpoly(c,x5)
%test with a ranom vector for c
len = randi([1 10],1,1);
c = randi([-10 10], 1, len);
x6 = 2;
z6 = arbpoly(c,x6)
%tests with random vector for c and x
c = randi([-10 10], 1, 5);
x7 = randi([-10 10], 1, 10);
z7 = zeros(1,10);
for i = 1:10
z7(i) = arbpoly(c,x7(i));
end
z7'
%%% this will plot the function
%%% uses a loop for x values
c = [-2 3 0 1];
x8 = linspace(-1.5,2.5,200);
z8 = zeros(1,200);
for i = 1:200
z8(i) = arbpoly(c,x8(i));
end
plot(x8,z8)
In: Computer Science
Write Matlab programs implementing the algorithms based on bisection,Newton, and secant method for numerical solution of scalar nonlinear equa-tions. Use these programs to compute approximations to real roots of the
following equations:
exp(x)−3x^2=0, (1)
x^3=x^2+x+1, (2)
exp(x) =1/(0.1 +x^2), (3)
and
x= 1 + 0.3 cos(x). (4)
Use an error tolerance tol=10^(−12). Display the obtained approximations to the roots of these equations, and compare the number of iterations, starting with the same initial values x0 for bisection and Newton methods, and with x0 and x1, where x1 was computed by bisection starting with x0, for secant method.
In: Advanced Math
1. You are trying to decide which 2 devices to install. The following are the details for the devices with a useful life of 5 years. Your MARR is 10%. What is the Benefit-Cost Ratio of Device 1?:
Device 1 Device 2 Device 3
Initial Cost $110,000 $200,000 $150,000
Salvage Value $10,000 $30,000 $20,000
O&M Costs $5,000 $2,000 $6,000
Annual Benefits $35,000 $40,000 $35,00 Year 1, increasing $5,000 each subsequent year
2.
what is the benefit - cost ratio for Device 2?
3. what is the benefit - cost ratio for Device 3?
4. what is the incremental benefit-cost ratio of the best alternatives?
In: Economics
I need to solve math problem by using freemat or mathlab
program. However, I can't understand how to make a code it.
This is one example for code ( freemat )
format long
f = @(x) (x^2) % define f(x) = x^2
a=0
b=1
N=23
dx = (b-a)/N % dx = delta_x
1. Methods:
(a) Left Rectangular Rule also known as Lower sum.
(b) Right Rectangular Rule also know as upper sum.
(c) Midpoint Rule
(d) Trapezoid Rule
(e) Simpson Rule
2. Evaluate
Integral {4/(x^2 + 1)} (Upper bound 1 Lower bound 0)
In: Advanced Math
Question 1
Two catalysts are being analysed to determine how they affect the mean yield of a chemical process. Specifically, catalyst 1 is currently used; but catalyst 2 is acceptable. Since catalyst 2 is cheaper, it should be adopted if it does not change the process yield. A test is run in the pilot plant and the results are shown as follows:
Catalyst Yield Data Observation Number 1 2 3 4 5 6 7 8 Catalyst 1
91.5 94.18 92.18 95.39 91.79 89.07 94.72 89.21
Catalyst 2 89.19 90.95 90.46 93.21 97.19 97.04 91.07 92.75
Is there any difference in the mean yields at 5% significance level
assuming equal variances? [20]
In: Civil Engineering
For each of the following sets of results, compute the
appropriate test statistic, test the indicated alternative
hypothesis, and compute the effects size(s) indicating their
magnitude:
| set | Hypothesis | μ0 | σ | n | α | |
| a) | μ ≠ μ0 | 51.4 | 50 | 3.6 | 49 | 0.05 |
| b) | μ > μ0 | 39.7 | 40.1 | 6.2 | 31 | 0.15 |
| c) | μ < μ0 | 31.8 | 30 | 8.9 | 33 | 0.10 |
a)
Compute the appropriate test statistic(s) to make a decision about
H0.
critical value =__________ ; test statistic =
________________
Decision: ***(choose one)*** 1. Reject H0 or 2. Fail to
reject H0
Compute the corresponding effect size(s) and indicate
magnitude(s).
d = _______________; *(choose one)1. na 2.
trivial effect 3. small effect 4. medium effect 5. large effect
b)
Compute the appropriate test statistic(s) to make a decision about
H0.
critical value = ; test statistic =
Decision: ---Select--- Reject H0 or Fail to reject
H0
Compute the corresponding effect size(s) and indicate
magnitude(s).
d ______________= ; *(choose
one)1. na 2. trivial effect 3. small effect 4. medium effect 5.
large effect
c)
Compute the appropriate test statistic(s) to make a decision about
H0.
critical value =__________ ; test statistic =
________________
Decision: ***(choose one)*** 1. Reject H0 or 2. Fail to
reject H0
Compute the corresponding effect size(s) and indicate
magnitude(s).
d ______________= ; *(choose
one)1. na 2. trivial effect 3. small effect 4. medium effect 5.
large effect
In: Statistics and Probability
Write a program that prompts the user to enter two characters and display the corresponding major and year status. The first character indicates the major. And the second character is a number character 1, 2, 3, 4, which indicates whether a student is a freshman, sophomore, junior, or senior. We consider only the following majors: B (or b): Biology C (or c): Computer Science I (or i): Information Technology and Systems M (or m): Marketing H (or h): Healthcare Management A (or a): Accounting Note that your program needs to let the user know if the major or year is invalid. Also, your program should be case-insensitive: your program should tell ''Marketing'' either user type 'm' or 'M'. Here are three sample runs: Sample 1: Enter two characters: i3 Information Technology and Systems Junior Sample 2: Enter two characters: B5 Biology Invalid year status Sample 3: Enter two characters: t2 Invalid major Sophomore 1 ITSS3311 Introduction to Programming Project 2 What to deliver? Your .java file including: 1. Five sample runs with the following five input: (20 points, 4 points each) (1) h1 (2) T3 (3) A2 (4) I0 (5) c4 Note that you need to run your program 5 times. Each time you run it, copy and paste the program output to the top of your program. (5 points for pasting the code in the beginning) 2. Your code with other appropriate comments. (Code: 50 points, Comments:25points)
In: Computer Science
magine a table is given as following. This table is called lookup table. The table works as following. It assigns a number to some uppercase or lowercase alphabents as shown in the table.
A B F M N P Q W Z
letter
number
letter
Number
12
e
8
10
f
3
5
i
2
4
m
0
0
n
1
11
p
2
10
q
3
9
r
4
9
s
5
1- Design and implement a function with 2 parameters: 1- a string (a word) 2- a variable that represents the above lookup table. The function converts the string to a number and returns it. This function replaces each character in the string with its corresponding number from the above table. If the character does not exist in the above table, the function replaces it with 0. The function will eventually return the number.
2- Define a main function and call the method you designed in 1. When calling the above function in the main method, pass to the function the word “We have missed Vancouver’s summer” and the above lookup table. What is the output of the function for the this word, “We have missed Vancouver’s summer” ?
python code
In: Computer Science
Twemty subgroups of size 5 are obtained for the purpose of determining trial control limits for mean and an R-chart.
| Subgroup | Mean | R |
| 1 | 23 | 5 |
| 2 | 22 | 3 |
| 3 | 24 | 2 |
| 4 | 20 | 4 |
| 5 | 18 | 3 |
| 6 | 17 | 4 |
| 7 | 24 | 4 |
| 8 | 10 | 3 |
| 9 | 16 | 5 |
| 10 | 20 | 4 |
| 11 | 26 | 5 |
| 12 | 21 | 4 |
| 13 | 22 | 4 |
| 14 | 20 | 4 |
| 15 | 23 | 3 |
| 16 | 21 | 6 |
| 17 | 20 | 5 |
| 18 | 18 | 4 |
| 19 | 15 | 3 |
| 20 | 17 | 2 |
A.) Determine the rial control limits for each chart. B.) Explain why there are so many subgroups averages outside the control limits for the mean chart in spite of the fact that the averages do not vary greatly. C.) What should be done with those subgroups whose averages is beyond the limits. D.) Since the number of points outside the control limits on the mean chart is quite high relative to the number of points that are plotted, what might this suggest about the type of distruibution from which the data could have come.
In: Math
A hydrogen atom
(Z = 1)
is in the fourth excited state, and a photon is either emitted or absorbed.
Concepts:
(i) What is the quantum number of the fourth excited state?
12 345
(ii) When an atom emits a photon, is the final quantum number
nf
of the atom greater than or less than the initial quantum
number ni?
greater thanless than
(iii) When an atom absorbs a photon, is the final quantum
number
nf
of the atom greater than or less than the initial quantum
number ni?
greater thanless than
(iv) How is the wavelength of a photon related to its energy? (Use
the following as necessary: c, E, and
h.)
? =
Calculations:
(a) Determine the quantum number
nf
of the final state and the energy of the photon when the photon is emitted with the shortest possible wavelength.
| nf | ---Select--- 1 2 3 4 5 6 | |
| Ephoton | = | eV |
(b) Determine the quantum number
nf
of the final state and the energy of the photon when the photon is emitted with the longest possible wavelength.
| nf | ---Select--- 1 2 3 4 5 6 | |
| Ephoton | = | eV |
(c) Determine the quantum number
nf
of the final state and the energy of the photon when the photon is absorbed with the longest possible wavelength.
| nf | ---Select--- 1 2 3 4 5 6 | |
| Ephoton | = | eV |
In: Physics