Create a variable named x and assign to it a row vector whos

Create a variable named x and assign to it a row vector whose elements equally spaced values starting with -15, ending at most with 15, in steps of 0.1. Create a variable named f. This variable is to store a row vector whose elements are those obtained by evaluating the following piecewise function below for every element of row vector x. f(x) = {|x-5| -10

Solution

1.

x=-15:0.1:15

x =

Columns 1 through 16

-15.0000 -14.9000 -14.8000 -14.7000 -14.6000 -14.5000 -14.4000 -14.3000 -14.2000 -14.1000 -14.0000 -13.9000 -13.8000 -13.7000 -13.6000 -13.5000

Columns 17 through 32

-13.4000 -13.3000 -13.2000 -13.1000 -13.0000 -12.9000 -12.8000 -12.7000 -12.6000 -12.5000 -12.4000 -12.3000 -12.2000 -12.1000 -12.0000 -11.9000

Columns 33 through 48

-11.8000 -11.7000 -11.6000 -11.5000 -11.4000 -11.3000 -11.2000 -11.1000 -11.0000 -10.9000 -10.8000 -10.7000 -10.6000 -10.5000 -10.4000 -10.3000

Columns 49 through 64

-10.2000 -10.1000 -10.0000   -9.9000   -9.8000   -9.7000   -9.6000   -9.5000   -9.4000   -9.3000   -9.2000   -9.1000   -9.0000   -8.9000   -8.8000   -8.7000

Columns 65 through 80

   -8.6000   -8.5000   -8.4000   -8.3000   -8.2000   -8.1000   -8.0000   -7.9000   -7.8000   -7.7000   -7.6000   -7.5000   -7.4000   -7.3000   -7.2000   -7.1000

Columns 81 through 96

   -7.0000   -6.9000   -6.8000   -6.7000   -6.6000   -6.5000   -6.4000   -6.3000   -6.2000   -6.1000   -6.0000   -5.9000   -5.8000   -5.7000   -5.6000   -5.5000

Columns 97 through 112

   -5.4000   -5.3000   -5.2000   -5.1000   -5.0000   -4.9000   -4.8000   -4.7000   -4.6000   -4.5000   -4.4000   -4.3000   -4.2000   -4.1000   -4.0000   -3.9000

Columns 113 through 128

   -3.8000   -3.7000   -3.6000   -3.5000   -3.4000   -3.3000   -3.2000   -3.1000   -3.0000   -2.9000   -2.8000   -2.7000   -2.6000   -2.5000   -2.4000   -2.3000

Columns 129 through 144

   -2.2000   -2.1000   -2.0000   -1.9000   -1.8000   -1.7000   -1.6000   -1.5000   -1.4000   -1.3000   -1.2000   -1.1000   -1.0000   -0.9000   -0.8000   -0.7000

Columns 145 through 160

   -0.6000   -0.5000   -0.4000   -0.3000   -0.2000   -0.1000         0    0.1000    0.2000    0.3000    0.4000    0.5000    0.6000    0.7000    0.8000    0.9000

Columns 161 through 176

    1.0000    1.1000    1.2000    1.3000    1.4000    1.5000    1.6000    1.7000    1.8000    1.9000    2.0000    2.1000    2.2000    2.3000    2.4000    2.5000

Columns 177 through 192

    2.6000    2.7000    2.8000    2.9000    3.0000    3.1000    3.2000    3.3000    3.4000    3.5000    3.6000    3.7000    3.8000    3.9000    4.0000    4.1000

Columns 193 through 208

    4.2000    4.3000    4.4000    4.5000    4.6000    4.7000    4.8000    4.9000    5.0000    5.1000    5.2000    5.3000    5.4000    5.5000    5.6000    5.7000

Columns 209 through 224

    5.8000    5.9000    6.0000    6.1000    6.2000    6.3000    6.4000    6.5000    6.6000    6.7000    6.8000    6.9000    7.0000    7.1000    7.2000    7.3000

Columns 225 through 240

    7.4000    7.5000    7.6000    7.7000    7.8000    7.9000    8.0000    8.1000    8.2000    8.3000    8.4000    8.5000    8.6000    8.7000    8.8000    8.9000

Columns 241 through 256

    9.0000    9.1000    9.2000    9.3000    9.4000    9.5000    9.6000    9.7000    9.8000    9.9000   10.0000   10.1000   10.2000   10.3000   10.4000   10.5000

Columns 257 through 272

   10.6000   10.7000   10.8000   10.9000   11.0000   11.1000   11.2000   11.3000   11.4000   11.5000   11.6000   11.7000   11.8000   11.9000   12.0000   12.1000

Columns 273 through 288

   12.2000   12.3000   12.4000   12.5000   12.6000   12.7000   12.8000   12.9000   13.0000   13.1000   13.2000   13.3000   13.4000   13.5000   13.6000   13.7000

Columns 289 through 301

   13.8000   13.9000   14.0000   14.1000   14.2000   14.3000   14.4000   14.5000   14.6000   14.7000   14.8000   14.9000   15.0000

 Create a variable named x and assign to it a row vector whose elements equally spaced values starting with -15, ending at most with 15, in steps of 0.1. Create
 Create a variable named x and assign to it a row vector whose elements equally spaced values starting with -15, ending at most with 15, in steps of 0.1. Create

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site