Question

In: Advanced Math

USING MATLAB.... a.) Create anonymous functions: fa(x)=sin(x^2) fb(x)=sin^2(x) b.) Evaluate them both at x=1/2 pi c.)Evaluate...

USING MATLAB....

a.) Create anonymous functions:

fa(x)=sin(x^2)

fb(x)=sin^2(x)

b.) Evaluate them both at x=1/2 pi

c.)Evaluate them both at x=(0,1,2,...,10)^T

d.) Calculate fa(fb(2)) and fb(fa(2))

Solutions

Expert Solution

clc;
clear all;
%%% Answer a
fa=@(x)sin(x.^2);
fb=@(x)(sin(x)).^2;

%%% Answer b
x1=pi/2;
disp('fa at x1')
fa(x1)
disp('fb at x1')
fb(x1)
%%% Answer c
x=0:10;
disp('fa at x=0 to 10')
fa(x)'
disp('fb at x=0 to 10')
fb(x)'
%%% Answer d
disp('fb(fa(2))')
fb(fa(2))
disp('fa(fb(2))')
fa(fb(2))

fa at x1

ans =

   0.624265952639699

fb at x1

ans =

     1

fa at x=0 to 10

ans =

                   0
   0.841470984807897
-0.756802495307928
   0.412118485241757
-0.287903316665065
-0.132351750097773
-0.991778853443116
-0.953752652759472
   0.920026038196791
-0.629887994274454
-0.506365641109759

fb at x=0 to 10

ans =

                   0
   0.708073418273571
   0.826821810431806
   0.019914856674817
   0.572750016904307
   0.919535764538226
   0.078073020633754
   0.431631390896083
   0.978829740161692
   0.169841645877960
   0.295958969093304

fb(fa(2))

ans =

   0.471419918046348

fa(fb(2))

ans =

   0.631614802553066

>>


Related Solutions

using Matlab only please. function sail_boat x = linspace(0,100,2*pi); for x plot(x, sin(x),'b','LineWidth',3) axis([0,2*pi+.1,-1.05,1.05]) hold on...
using Matlab only please. function sail_boat x = linspace(0,100,2*pi); for x plot(x, sin(x),'b','LineWidth',3) axis([0,2*pi+.1,-1.05,1.05]) hold on boat(x,sin(x)) pause(.05) end function boat(x,y) xc = [x-.1,x+.1,x+.2,x-.2,x-.1]; yc = [y,y,y+.1,y+.1,y]; plot(xc,yc,'k') The function is supposed to plot a sine curve and an animation of a representation of a boat moving on top of the curve, but the code has several errors. Notice that the program uses modulization and it calls another function inside sail_boat. Correct the code and submit it with a new...
Evaluate the following limits using l'Hopital's rule. (a) lim x→0 (sin(x)−x)/(x^2) (b) lim x→0 (1/x) −...
Evaluate the following limits using l'Hopital's rule. (a) lim x→0 (sin(x)−x)/(x^2) (b) lim x→0 (1/x) − (1/e^x−1) (c) lim x→0+ (x^√ x)
2. Evaluate the following limits. (a) lim x→1+ ln(x) /ln(x − 1) (b) limx→2π x sin(x)...
2. Evaluate the following limits. (a) lim x→1+ ln(x) /ln(x − 1) (b) limx→2π x sin(x) + x ^2 − 4π^2/x − 2π (c) limx→0 sin^2 (3x)/x^2
4. For a signal x(n)=sin(2*pi*n/3) defined for n=0to7, evaluate the Fast Fourier Transform using signal flow...
4. For a signal x(n)=sin(2*pi*n/3) defined for n=0to7, evaluate the Fast Fourier Transform using signal flow graph. (Use decimation in frequency Algorithm)     
For a signal x(n)=sin(2*pi*n/5) defined for n=0to7, evaluate the Fast Fourier Transform using signal flow graph....
For a signal x(n)=sin(2*pi*n/5) defined for n=0to7, evaluate the Fast Fourier Transform using signal flow graph. (Use decimation in Time Algorithm).                                               
For a signal x(n)=sin(2*pi*n/5) defined for n=0to7, evaluate the Fast Fourier Transform using signal flow graph....
For a signal x(n)=sin(2*pi*n/5) defined for n=0to7, evaluate the Fast Fourier Transform using signal flow graph. (Use decimation in Time Algorithm).                                               
Find dy/dx for a & b a) sin x+cos y=1 b) cos x^2 = xe^y c)Let...
Find dy/dx for a & b a) sin x+cos y=1 b) cos x^2 = xe^y c)Let f(x) = 5 /2 x^2 − e^x . Find the value of x for which the second derivative f'' (x) equals zero. d) For what value of the constant c is the function f continuous on (−∞,∞)? f(x) = {cx^2 + 2x, x < 2 ,   2x + 4, x ≥ 2}
Evaluate (please answer all of them) 1) ∫ 1.67 ?^(1/3) ?? = 2) ∫ [(?^3+ sin(4?))...
Evaluate (please answer all of them) 1) ∫ 1.67 ?^(1/3) ?? = 2) ∫ [(?^3+ sin(4?)) / (?^4−cos(4?)+4)] ?? = 3) ∫ ???^8(4?)cot(4?) ?? = 4) ∫ sec^2(4?) ???^5(4?) ?? = 5) ∫ (4x^3) / ((x^4)+3) dx=
Write the matlab command to sample the following signals at nyquist frequency 1.x(t)=3cos(2*pi(400)t +0.3*pi) 2.x(t)=cos^2(300*pi*t)
Write the matlab command to sample the following signals at nyquist frequency 1.x(t)=3cos(2*pi(400)t +0.3*pi) 2.x(t)=cos^2(300*pi*t)
a. Using Matlab scripts create the following matrices (???1 and ???2) ???1 = [ 3 2...
a. Using Matlab scripts create the following matrices (???1 and ???2) ???1 = [ 3 2 −3 6 7 4 3 −6 7 ], ???2 = [ 2 1 7 3 3 9 −6 6 1 ]    b. Write code to add the second row of ???1 to the third row of ???2 and store results in the first row of ???1. c. Write code to add the second column of ???1 with the third column of ???2 and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT