Question

Write a Matlab script that plots the following functions over 0 ≤ x ≤ 5π:

f1(x) = sin2 x − cos x,

f2(x) = −0.1 x 3 + 2 x 2 + 10,

f3(x) = e −x/π ,

f4(x) = sin(x) ln(x + 1).

The plots should be in four separate frames, but all four frames should be in one figure window. To do this you can use the subplot command to create 2 × 2 subfigures.

Answer #1

**MATLAB
code**

close all

clear

clc

x = 0:0.1:5*pi;

f1 = (sin(x)).^2 - cos(x);

f2 = -0.1*x.^3 + 2*x.^2 + 10;

f3 = exp(-x/pi);

f4 = sin(x).*log(x+1);

figure

subplot(221), plot(x,f1), xlabel('x'), ylabel('f_1(x)'),
title('f_1(x) vs. x');

subplot(222), plot(x,f2), xlabel('x'), ylabel('f_2(x)'),
title('f_2(x) vs. x');

subplot(223), plot(x,f3), xlabel('x'), ylabel('f_3(x)'),
title('f_3(x) vs. x');

subplot(224), plot(x,f4), xlabel('x'), ylabel('f_4(x)'),
title('f_4(x) vs. x');

**plot**

Determine if the set of functions is linearly independent:
1. f1(x)=cos2x, f2(x)=1, f3(x)=cos^2 x
2. f1(x)=e^ x, f2(x)=e^-x, f3(x)=senhx

1. Create a script named AnonIntegrals.m. Within it, define each
of the following functions as anonymous functions and use the
integral command to compute its definite integral over the domain
given. Display the integral calculation to the command window. (a)
p(x) = 4x 2 − 1, x ∈ [0, 1] (b) q(x) = sin(x), x ∈ [0, π] (c) r(x)
= cos(x), x ∈ [−π/2, π/2] (d) s(x) = log(x), x ∈ [0, 1] (e) t(x) =
1 x ,...

For each of the following functions fi(x), (i) verify that they
are legitimate probability density functions (pdfs), and (ii) find
the corresponding cumulative distribution functions (cdfs) Fi(t),
for all t ? R.
f1(x) = |x|, ? 1 ? x ? 1
f2(x) = 4xe ?2x , x > 0
f3(x) = 3e?3x , x > 0
f4(x) = 1 2? ? 4 ? x 2, ? 2 ? x ? 2.

I am using matlab and getting a "matrix dimensions error below"
for line 22. Can someone spot the error and try the code to fix the
error.
%The beginning step is to generate a functionf(t) that consists
of the sum
%of the following components
% 25 Hz cosine function of magnitude 1
% 50 Hz sine function of magnitude 1
% 40 Hz square wave function of magnitude 1
clear; clc;
close all;
%sample rate is given at 2500 Hz...

Using MATLAB
The range of an object shot at an angle θ (with respect to
x-axis), with the initial velocity of V0 (in the absence of air
resistance), is calculated by the following formula:
range=(Vo^2/g)(sin(2theta)) where (0<=theta<=pi/2) And the
trajectory of object is given by:
h=tan(theta).x-(g/2Vo^2*cos^2(theta)).x^2 .Where h is the height of
the object at each x location and g = 9.81 m/s2.
a) Using π/8 increment size for the angle and V0 = 10 m/s, plot
the trajectories of...

Important Instructions: (1) λ is typed as lambda. (2) Use
hyperbolic trig functions cosh(x) and sinh(x) instead of ex and
e−x. (3) Write the functions alphabetically, so that if the
solutions involve cos and sin, your answer would be
Acos(x)+Bsin(x). (4) For polynomials use arbitrary constants in
alphabetical order starting with highest power of x, for example,
Ax2+Bx. (5) Write differential equations with leading term
positive, so X′′−2X=0 rather than −X′′+2X=0. (6) Finally you need
to simplify arbitrary constants. For...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 5 minutes ago

asked 6 minutes ago

asked 10 minutes ago

asked 13 minutes ago

asked 16 minutes ago

asked 19 minutes ago

asked 22 minutes ago

asked 38 minutes ago

asked 47 minutes ago

asked 47 minutes ago

asked 47 minutes ago

asked 1 hour ago