Question

In: Computer Science

MATLAB is program Respond fast please a quiz Create a MATLAB script. Using nested for loops,...

MATLAB is program

Respond fast please a quiz

Create a MATLAB script.

Using nested for loops, evaluate the multivariable function:

z = sin ⁡ ( x ) cos ⁡ ( y )

for

  • x between -4 and 4 in steps of 1
  • y between -2 and 2 in steps of 1

Display the matrix z

Cut and paste the following into a word doc and submit to this question.

  • Your script code
  • Your input
  • Your output

Solutions

Expert Solution

%% Matlab code for Z = sin(x)cos(y)
clear all;
close all;
clc;
% x and y declaration
x=-4:1:4
y=-2:1:2
% z is created as empty vector and later values gets appended 
z=[]
%% Nested For Loops for evaluation
for i=1:length(x)
    for j=1:length(y)
        z=[z sin(x(i))*cos(y(j))]
    end
end
%% Display of the Result
disp(z)

The above picture talks about Matlab code as per Question.Code works well and satisfies all requirments.

The above picture talks about the output of code (z matrix)


Related Solutions

Can you create a player vs computer Hangman game on MATLAB using nested loops, for loops,...
Can you create a player vs computer Hangman game on MATLAB using nested loops, for loops, if loops, while loops, arrays and conditional execution, as well as creating an image of the game board. The list below must be considered in the code. - Selecting a word from a dictionary (a text file) - Reading a single letter from the user - Building a character array showing the letters matched so far - Keeping count of the number of guessed...
create a function in matlab that sums two m x n matrices using nested loops, then...
create a function in matlab that sums two m x n matrices using nested loops, then returns result into a new matrix. Use nesed for loops to add matrices piece by piece. Basically means, dont program simply A+B Function should perform error check to make sure both matrices have same number of rows/ columns.
Using Matlab: Using nested for loops (other methods are not allowed), write a function which takes...
Using Matlab: Using nested for loops (other methods are not allowed), write a function which takes as input a matrix, and as output returns true if at least one entry in the matrix is strictly greater than 8 and returns false otherwise.
Matlab script that uses loops to create a multiplication table (matrix) where the user enters 'n'...
Matlab script that uses loops to create a multiplication table (matrix) where the user enters 'n' (nxn chart).
Write a Matlab program to create specialized plot animation with 16 frames by using fast Fourier...
Write a Matlab program to create specialized plot animation with 16 frames by using fast Fourier transforms of complex matrices
In this exercise we will practice using nested loops. You will write s program that prompts...
In this exercise we will practice using nested loops. You will write s program that prompts the user to enter an integer between 1 and 9 and displays a pyramid of numbers, as shown in the example below. The program must validate the input given by the user and make sure that: if the user enters a non-integer the program issues an error message and requests the user provides a valid input. if the user does not enter a number...
**MATLAB Code only Please create a MATLAB script that is a TIC-TAC-TOE game. Please keep it...
**MATLAB Code only Please create a MATLAB script that is a TIC-TAC-TOE game. Please keep it simple, but there is no other rules. Thank you.
Write a program that uses nested for loops to print a multiplication table. Your program should...
Write a program that uses nested for loops to print a multiplication table. Your program should print out the multiplication table starting a 1 and going to 12. Output should be like: 1 x 1 = .1 x 2 = 2
Using Matlab Write a program that print the following matrix. (hint: use nested for-loop and if-statement)...
Using Matlab Write a program that print the following matrix. (hint: use nested for-loop and if-statement) mat = [2 -1 0 0 0 -1 2 -1 0 0 0 0 -1 2 -1 0 0 0 -1 2];
In C 1- Use nested for loops to create an addition lookup table. Fill in an...
In C 1- Use nested for loops to create an addition lookup table. Fill in an array and print out the following table showing the sum of the row and column numbers 0-9. 0 1 2 3 4.. <- column numbers 1 2 3 4 5.. 2 3 4 5 6.. <- These nos. = Row + Column 3 4 5 6 7.. <- for example 7 = 3 + 4 4 5 6 7 8.. ... ^Row numbers 2-...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT