Question

THIS IS A MATLAB SCRIPT Consider your name as representing numbers of the alphabet in reverse...

THIS IS A MATLAB SCRIPT

Consider your name as representing numbers of the alphabet in reverse (A = 26, B=25, etc). Write a Matlab script to answer the following:

1. Sum of first name + Last name

2. Ratio of first name / Last name

3. Sum of first name raise to power of sum of last name

Keanu Reeves

Homework Answers

Answer #1

f = 'Keanu'
s1=0%tostore sum
for j=1 :length(f)
n = double(f(j))
if 65<=n && n<=90
n=n-65
elseif 97<=n && n<=122
n=n-97
end
n=26-n
s1=s1+n%finding sum
end
s ='Reeves'
s2=0%tostore sum
for j=1 :length(s)
n = double(s(j))
if 65<=n && n<=90
n=n-65
elseif 97<=n && n<=122
n=n-97
end
n=26-n
s2=s2+n%finding sum
end
%1
fprintf('Sum of first name + last name :%d\n',s1+s2)
%2
fprintf('Ratio of first name / last name :%f\n',s1/s2)
%3
fprintf('Sum of first name raise to power of sum of last name :%d\n',s1^s2)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
I need MATLAB code no handwritten solution required. Write a MATLAB script to solve the following...
I need MATLAB code no handwritten solution required. Write a MATLAB script to solve the following equations using the Cramer’s rule, and compare your results with MATLAB’s root finding method ( 25 pts. ). 8x1 − 2x2 − 1x3 = 5 − 2x1 + 9x2 − 4x3 − x4 = 2 − x1 − 3x2 + 7x3 − x4 − 2x5 = 1 − 4x2 − 2x3 + 12x4 − 5x5 = 1 − 7x3 − 3x4 − 15x5 =...
Using MATLAB or Octave, use documenting code to Write a script that prompts the user for...
Using MATLAB or Octave, use documenting code to Write a script that prompts the user for a non-negative integer value a. The script should then evaluates the sum Pn i=1 i a using a running sum for the case when n = 5. More specifically, use a counter for i that is used in the output fprintf as well as in the running sum. Feel free to write some code and just repeat it 5 times in your script. Sample...
Could you script in Matlab : Script Name General Algorithm AddNewEmployee Display all of the ID...
Could you script in Matlab : Script Name General Algorithm AddNewEmployee Display all of the ID numbers currently in use Read in a new ID number If the ID number read in is already in use Report this fact End this script Else (this is a new ID number) Read in: Years with the company Salary Vacation days Sick days Add this new employee to the database (by appending a new row to the end of the EmployeeData matrix) Note...
MATLAB Write a script "readFile.m" which:   a. reads a given file "file.dat" into a matrix "XYZ",  ...
MATLAB Write a script "readFile.m" which:   a. reads a given file "file.dat" into a matrix "XYZ",   b. extracts the columns of the data from "XYZ" into arrays "c1", "c2", ..., "cN",   c. plots some column versus another column, with a title, and labeled axes.   To test and debug your code, create a "file.dat" with 3 rows and N=2 columns ( so a 3×2 matrix ).   The first column should be sorted. You can just enter some numbers in "file.dat" in...
Save your select statements as a script. Place the semicolon at the end of each SQL...
Save your select statements as a script. Place the semicolon at the end of each SQL statement. Please number your select statements from 1 to 8 in your script and comment out each number. Include your name and student number as a comment at the top of your script. The name of the script has to be Assignment1_JohnSmith. Instead of JohnSmith use your First Name and Last Name. Upload your script trough Blackboard. Use SQL Developer to create the My...
A. Create a PowerShell script named “restore.ps1” within the “Requirements2” folder. For the first line, create...
A. Create a PowerShell script named “restore.ps1” within the “Requirements2” folder. For the first line, create a comment and include your first and last name along with your student ID. Note: The remainder of this task shall be completed within the same script file, “restore.ps1.” B. Write a single script within the “restore.ps1” file that performs all of the following functions without user interaction: 1. Create an Active Directory organizational unit (OU) named “finance.” 2. Import the financePersonnel.csv file (found...
The first script you need to write is login.sh, a simple script that you might run...
The first script you need to write is login.sh, a simple script that you might run when you first log in to a machine. We'll expand this script later, but for now it should include your name, username, hostname, current directory, and the current time. Here is some sample output to help guide you. Note that the bolded lines that start with "[user@localhost ~]$" are the terminal prompts where you type in a command, not part of the script. Of...
Write a MATLAB function and test bench script code to solve the above simple RL/RC circuits...
Write a MATLAB function and test bench script code to solve the above simple RL/RC circuits by following the instructions noted below. The input signal and impulse response generation should be done in the function. The test bench script should be used only to call the function and for signal plotting purposes. No plotting should be done inside the function itself. Name your function L2_C Instructions: Input voltage ,x(t), can be AC or DC. Consider a variable ‘w1’ which can...
Bash script with branching and looping Part 1: 1. Create a variable called NAME and set...
Bash script with branching and looping Part 1: 1. Create a variable called NAME and set it equal to the empty string (NAME=””). Create a variable called NAME_LENGTH and set it equal to the length of your last name. Output the value of the NAME variable to show that it is empty. 2. Write a FOR loop that executes as many times as there are letters in your name (use the NAME_LENGTH variable in your condition). Use a CASE statement...
Matlab Queatoin: The test suite generates a random M x N matrix with a random number...
Matlab Queatoin: The test suite generates a random M x N matrix with a random number of rows and columns that is assigned to the variable A . The element values of the matrix are random double precision numbers that fall in the range from -10 to 10. The matrix has between 5 and 10 rows and between 5 and 10 columns. Assuming A is defined in the workspace, write a script with commands to perform the operations described below...