Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab Use a for loop to compute a sum II O solutions submitted (max: 10) One of the most common applications of for loops in

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Matlab
Use a for loop to compute a sum II O solutions submitted (max: 10) One of the most common applications of for loops in MATH 307 is to compute a sum: Use the following lines to create a vector of length 1000 Png(307); * set the random number generator seed so everyone gets sane answer x = rand(1, 1000)*2-1; } create vector of random # Write MATLAB code that computes how many elements of the vector x are less than or equal to 0.2. Store the result in a variable called mysum. Script 1 rng(307); % set the random number generator seed so everyone gets same answer 2 X = rand(1,1000)*2-1; % create vector of random #s 3 Temperature Counting O solutions submitted (max: 10) The daily high temperatures in New York, NY and Anchorage, AK for a bunch of days in a row are given: TNY - [31, 26, 30, 33, 33, 39, 41, 41, 34, 33, 45, 42, 36, 39, 37, 45,... 36, 45, 22, 28, 46, 48, 45, 48, 29, 26, 52, 46, 24, 36, 48, 32,... 43, 36, 41, 37, 32, 32, 35, 42, 38, 33, 40, 37, 36, 51, 50) TAN [37, 24, 28, 25, 21, 28, 46, 37, 36, 28, 24, 31, 34, 40, 43, 36,... 47, 23, 42, 28, 34, 47, 44, 38, 23, 32, 37, 40, 22, 24, 49, 51,... 34, 41, 42, 35, 38, 36, 35, 33, 42, 42, 37, 26, 20, 25, 31); Write a script to: 1. Count the number of days that the temperature in NY was above the average temperature of NY. Store the answer in a variable called aboveNY. 2. Count the number of days that the temperature in AK was above the average temperature of AK Store the answer in a variable called aboveAK 3. Count how many days the temperature in AK was higher than that in NY. Store the answer in a variable called Akhigher. Script 1 TNY = 2 3 [31, 26, 30, 33, 33, 39, 41, 41, 34, 33, 45, 42, 36, 39, 37, 45,... 36, 45, 22, 28, 46, 48, 45, 40, 29, 26, 52, 46, 24, 36, 48, 32, ... 43, 36, 41, 37, 32, 32, 35, 42, 38, 33, 40, 37, 36, 51, 50); [37, 24, 28, 25, 21, 28, 46, 37, 36, 20, 24, 31, 34, 40, 43, 36,... 47, 23, 42, 28, 34, 47, 44, 38, 23, 32, 37, 40, 22, 24, 49, 51, ... 34, 41, 42, 35, 38, 36, 35, 33, 42, 42, 37, 26, 20, 25, 31); 4 TAN = 5 6 7 8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

Write formal and informal proposals.

Answered: 1 week ago