Question

In: Electrical Engineering

matlab Q1) a) create a vector that starts at a, ends at b, and has a...

matlab

Q1)

a) create a vector that starts at a, ends at b, and has a spacing of c (allow the user to input all of these parameters)

b)create an inches vector using a,b and c

c) calculate the corresponding values of feet in another vector (1feet=12 inches)

d) group the inch vector and the feet vector together into a table matrix

e)use the disp command to create a title for a table that converts inches to feet

f)use the disp command to create column headings for your table

g)use fprintf command to send your table to the command window

Solutions

Expert Solution

Ans)===============Matlab code============

a = input('Enter a :' ); %prompts user to enter 'a' value
b = input('Enter b :' ); %prompts user to enter 'b' value
c = input('Enter c :' ); %prompts user to enter 'c' value

%=====part-a=======
vec=a:c:b %vector starts at 'a' ends at 'b' with spacing 'c'

%========part-b========
inches=a:c:b %inches vector

%=======part-c======
feets=inches/12 %feets vector

%=======part-d=======
%creating table
tableM(:,1)=inches';
tableM(:,2)=feets';

%===========part-e============
disp('Table showing inches to feets')

%===============part-f========

disp(' inches feets')

%==============part-g========

fprintf(1,'\t\t%f\t\t%f\n',tableM')

%===================================================

%===result in command window when you run the above code===

>> solution

Enter a :1

Enter b :10

Enter c :1

vec =

1 2 3 4 5 6 7 8 9 10

inches =

1 2 3 4 5 6 7 8 9 10

feets =

Columns 1 through 7

0.0833 0.1667 0.2500 0.3333 0.4167 0.5000 0.5833

Columns 8 through 10

0.6667 0.7500 0.8333

Table showing inches to feets

inches feets

1.000000 0.083333

2.000000 0.166667

3.000000 0.250000

4.000000 0.333333

5.000000 0.416667

6.000000 0.500000

7.000000 0.583333

8.000000 0.666667

9.000000 0.750000

10.000000 0.833333

>>

================================


Related Solutions

function X=extractDWT(x_train,startS,endS,wStep,wRange) % x_train = input signal % startS   = from second % endS     = end...
function X=extractDWT(x_train,startS,endS,wStep,wRange) % x_train = input signal % startS   = from second % endS     = end second % wStep   = overlapping % wRange = window size FS=128; N=size(x_train,3); sz=floor((endS-(startS+wRange))/wStep)+1; X=zeros(sz*140,2); cn=0; for i=1:N         for sig=startS:wStep:endS-wRange                 sW=sig*FS+1;         eW=(sig+wRange)*FS;                 C3Sig=x_train(sW:eW,1,i);         C4Sig=x_train(sW:eW,3,i);                 waveletFunction = 'db4';         waveletLevel=3;         [wCoe,L] = wavedec(C3Sig,waveletLevel,waveletFunction);         C3D3 = detcoef(wCoe,L,3);   % Mu                         [wCoe,L] = wavedec(C4Sig,waveletLevel,waveletFunction);         C4D3 = detcoef(wCoe,L,3); % Mu                 cn=cn+1;        ...
MATLAB. A three vector force system has forces as outlined, use a three element vector to...
MATLAB. A three vector force system has forces as outlined, use a three element vector to represent the x, y, and z terms respectively, F = [x_value, y_value, z_value]. Find the resultant force when: F1 has a magnitude of 120 N and is in the x-y plane, 35 degrees BELOW the positive x axis, F2 has a magnitude of 810 N and is in the x-z plane, 100 degrees ABOVE the positive x axis, and F3 has a magnitude of...
Create a function that takes a vector of vectors as an argument. Each inner vector has...
Create a function that takes a vector of vectors as an argument. Each inner vector has 2 elements. The first element is the numerator and the second element is the denominator. Return the sum of the fractions rounded to the nearest whole number. Examples: sum_fractions({{18, 13}, {4, 5}}) ➞ 2 sum_fractions({{36, 4}, {22, 60}}) ➞ 9 sum_fractions({{11, 2}, {3, 4}, {5, 4}, {21, 11}, {12, 6}}) ➞ 11 Notes Your result should be a number not string. Code in C++...
The accounting cycle starts with analysis of business transactions and ends with the preparation of a...
The accounting cycle starts with analysis of business transactions and ends with the preparation of a post-closing trial balance. To recap, what is the implication of missing a step. Must the steps be performed following the same sequence? If yes, why is it important to follow the steps?
Describe a purification scheme that starts with a mixture of cells, virions and proteins and ends...
Describe a purification scheme that starts with a mixture of cells, virions and proteins and ends with a tube containing pure virions. Or, how about obtaining a supernatant solution containing only pure virions?
The following code must be written using matlab How to loop through a vector in matlab...
The following code must be written using matlab How to loop through a vector in matlab and assigning a value to every 4th entry. The vector could be of any length. Thanks
Use MATLAB to create a vector x having six values between 0 and 10 (including the endpoints 0 and 10
Use MATLAB to create a vector x having six values between 0 and 10 (including the endpoints 0 and 10). Create an array A whose rst row contains the values 3x and whose second row contains the values 5x - 20.  
Use Matlab to introduce arow vector,f,and define it as a 1 by 4 vector showing values...
Use Matlab to introduce arow vector,f,and define it as a 1 by 4 vector showing values of 1, 2, 3and 4. Now try to build matrix D, using the following 2 commands a.D = [f ; A] b.D= [f , A] c.Which one can be built,and which one cannot be built? Explain your answer. Matrix A, which is a 4by 4 matrix, (The first, second, third and fourth column values are:2,4,6,8and 1,3,5,7 and 8,6,4,2 and 7,5,3,1 , respectively.
A man starts a random walk at a lamp post. a)What is the probability he ends...
A man starts a random walk at a lamp post. a)What is the probability he ends up back at the lamp post after 8 steps? b)There is a wall 3 steps down the path. What is the probability he ends up back at the lamp post after 10 steps? Within 3 steps of the lamp post after 10 steps? c)There is a pit of alligators 3 steps down the path. If he takes 10 steps, what is the probability the...
Exercise 3 Part 1. Solving a system Ax = b **Create a function in MATLAB that...
Exercise 3 Part 1. Solving a system Ax = b **Create a function in MATLAB that begins with: function [C,N]=solvesys(A) [~,n]=size(A); b=fix(10*rand(n,1)) format long We are using format long to display a number in exponent format with 15 digit mantissas. If later on, you will need to switch back to the default format, type and run format The input is an matrix A. If A is invertible, the outputs are the matrix C, whose 3 columns x1, x2, x3 are...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT