7)
clc%clears screen
clear all%clears history
close all%closes all files
format long
i=1;
num=3^i;
hat=[];
while(num<=7000)
hat=[hat num];
i=i+1;
num=3^i;
end
hat
answer 4, 5, 6, 7 using matlab Homework 10 1. Write the correct first-line syntax for...
S.A vector IS givell by [5, 17,-3, 8, 0,-7, 12, 15, 20,-6, 6, 4,-7, 16]. Write a program as a 3 or 5, and, raises to the power of 3 the elements that are script tile that doubles the elements that are positive and are divisible by negative but greater than -5. following values. The value of each element in the first row is the number of the 6. Write a program in a script file that creates an matrix...
Use Matlab Given: x = [13, 5, 7, 9, 1, 4, 7, 10, 13] Use one 'for loop' to create the matrix y of dimension 5X2, using the index to program the address and the value of each element of y; and y = x' Given, x = [2, 3, 4, 5, 3, 4, 5, 6] Use two 'for loops' to create the matrix of dimension 4X2 Use a while statement to determine when the sum of the numbers in...
write matlab script 5. Use a for loop to sum the elements in x = [1 2 3 4 5] Check your answer with sum function 6. Use a while loop to sum the elements in x = [1 2 3 4 5] Check your answer with sum function
Matlab Homework Please write a script that does the following: generates a 3 x 5 matrix of random integersand call it A. generates a 3 x 3matrix of random integers and call it B. "Fix" A so it can be compared to B How do we "Fix" A? Make sure to reassign the value to A Tell me how many elements of A are greater than or equal to B This can be done in a single line. You will...
use matlab and show all codes and work the question continues from this 4. Write a function with header (A, V - myCone (r, h), which outputs the total area A and volume of a cone with base radius r and height h. 5. Write a function - myMatrix (myvec, m, n) which creates an m-by-n matrix A, as in Problem 3, but for arbitrary values of mand n and any length of vector myvec. Hint: the function can use...
Matlab 1 question help Question5 Given X [ 3 562; 189 6; 4071], write MATLAB command to do the following operations: a) Multiply the value of the elements in first and third rows and second and fourth columns by 3 and store it in another matrix, what will be its value b) Calculates the number of the elements in each column greater than 5 c) Get the min number in the second column
4-6 on matlab 4. Write a program in a script file that determines the real roots of a quadratic equation ax2+bx+c 0 When the file runs, it asks the user to enter the values of the constants a, b, and c. To calculate the roots of the equation the program calculates the discriminant D, given by: D b2-4ac When D 0, the program displays message "The equation has two roots," and the roots are displayed in the next line. When...
In MATLAB The value of cos(x) can be approximated using a Maclaurin series + +... cos(x)=1-1 2! 4! 6! Which can be expressed compactly as cos(x) = {(-1)+7 (2(k-1))! 00 2(k-1) k-1 Write Matlab code using a while loop that calculates cos(2) with 5 terms of Maclaurin series. Compare the value with the one calculated with a built-in function cos (2) in Matlab. The following is an expected output from your code: Using the Maclaurin series cos( 2.0) with 5...
Write a script that prompts the user to enter a value n (n > 6) that will generate an n element vector of random integers between 0 and 100 that will represent quiz grades. Then have the script calculate the average of the quizzes where the smallest grade is dropped. Then script will display the average of the quizzes along with the highest quiz grade. Given the following system of equations: 8s - 11t + 7u + 5v - w...