Question

In: Computer Science

1. Given a vector, a, of length n, write down the MATLAB expressions that will correctly...

1. Given a vector, a, of length n, write down the MATLAB expressions that will correctly compute the following:

a.        ln (3 + a + a2 )

b.         ea (1 + cos(3a))

c.         cos2 (a) + sin2 (a)

d.         tan-1 (a)

Test that your solution works for a = 1:0.2:2

2. a. Create a vector of odd whole numbers between 10 and 40.

      b. Create a vector of even whole numbers between 25 and 35.

3. Plot a Straight line with slope m=0.5 c=-2 at the following coordinates X=0, 4,5,7,9,10,12,15.

4.   Plot y=sin x, 0<=x<=4pi, taking 50,100 linearly spaced points in the given interval.

Solutions

Expert Solution

a=1:.2:2;
%1)
a1 = log(3 + a + a.^2)
b1 = exp(a).*(1 + cos(3*a))
c1 = cos(a).^2 + sin(a).^2
d1=atan(a)
%2
a2 = 11:2:40
b2=26:2:35
%3
X=[0, 4,5,7,9,10,12,15];
Y = .5*X - 2;
plot(X,Y)
%4
x=linspace(0,4*pi,50);
y=sin(x);
plot(x,y)
%5
x=linspace(0,4*pi,100);
y=sin(x);
plot(x,y)




Related Solutions

write matlab script of N channel MOSFET (Iv curve) will like and comment if done correctly...
write matlab script of N channel MOSFET (Iv curve) will like and comment if done correctly plesse
Write 2 MATLAB functions. One called exptrig which takes a vector of arbitrary length, x, containing...
Write 2 MATLAB functions. One called exptrig which takes a vector of arbitrary length, x, containing any real numbers, and computes the mathematical function f(x) = 3e^(-x)(cos^2(5x) - sin^2(5x)). The other one will be called trigsum, which takes a vector arbitrary length, x, containing any real numbers, and computes the mathematical function g(x)= ((sin(10x) + cos(10x))/ 2) + 3. Both functions will be computed at each of the values of x, and internally will output these values into a vector,...
1 Write down the expressions for centripetal force and angular momentum 2 What are the units...
1 Write down the expressions for centripetal force and angular momentum 2 What are the units of moment of inertia? 3 In Fig.1 show that the tension, T, in the string causing the pulley to rotate is given by T = m(g-a) where a is the linear acceleration of the falling mass. 4 In part III, what factors could cause the angular momentum not to be conserved?
Consider the AS-AD model of a closed economy. a. Write down the expressions for the AS...
Consider the AS-AD model of a closed economy. a. Write down the expressions for the AS and AD curves and interpret the expressions: what is the intuition behind the two curves? What must be true of the model parameters and variables in the long-run equilibrium, i.e. in the steady state? b. Analyse the effects of a supply shock that causes a temporary increase in inflation, using a diagram. Assume that the shock lasts for one period and then assumes the...
Write a C++ program that has a function which given n>=0, create an array length n*n...
Write a C++ program that has a function which given n>=0, create an array length n*n with the following pattern, shown here for n=3 : {0, 0, 1, 0, 2, 1, 3, 2, 1} (spaces added to show the 3 groups) generateGroups(3) → [0, 0, 1, 0, 2, 1, 3, 2, 1] generateGroups(2) → [0, 1, 2, 1] generateGroups(4) → [0, 0, 0, 1, 0, 0, 2, 1, 0, 3, 2, 1, 4, 3, 2, 1]
2. Vector Element Calculation Write a MATLAB script which will randomly generate a 20-element vector with...
2. Vector Element Calculation Write a MATLAB script which will randomly generate a 20-element vector with integer values ranging between −100 to +100. Using LOOP command, determine the number of negative elements in the vector. For example, given A = [15 −6 0 -8 −2 5 4 −10 -3 −5], the number of negative numbers are 6.
can a vector with dimensions R^N and a vector with dimensions R^N+1 be a matrix? and...
can a vector with dimensions R^N and a vector with dimensions R^N+1 be a matrix? and if so what would it dimension size be?
Given the vector F1 = 100 N, Ѳ1 = 20o , and F2 = 200 N,...
Given the vector F1 = 100 N, Ѳ1 = 20o , and F2 = 200 N, Ѳ2 = 90o   and F3= 300 N, Ѳ3 =220o . Find the magnitude and direction of the resultant F= F1 + F2 + F3 using the following method: Analytical: Use the component method. (6pts.) Graphical: Use the polygon method. (6pts.) Use a percent error calculation to determine how close the graphical result are to the analytical method.
using the expressions for associated legendres polynomals write down rotational wavefunctions that are possible for a...
using the expressions for associated legendres polynomals write down rotational wavefunctions that are possible for a molecule in the l=2 level level.
Fibonacci Write pseudocode to calculate F(n) Write pseudocode to construct a vector of the first n...
Fibonacci Write pseudocode to calculate F(n) Write pseudocode to construct a vector of the first n numbers in the Fibonacci sequence. Write a function: fibo(n = 1){ # Your code here } which takes one parameter ​n​ and returns the ​nth​ fibonacci number. Use the function you wrote to calculate the 58th Fibonacci number. Include your R code in your report The Fibonacci sequence (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ...) is defined as F(1) =...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT