1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
solniwko [45]
3 years ago
11

Modify an array's elements Write a for loop that iterates from 1 to numberSamples to double any element's value in dataSamples t

hat is less than minValue. Ex: If minVal = 10, then dataSamples = [2, 12, 9, 20] becomes [4, 12, 18, 20]. Function Save Reset MATLAB DocumentationOpens in new tab function dataSamples = AdjustMinValue(numberSamples, userSamples, minValue) % numberSamples: Number of data samples in array dataSamples % dataSamples : User defined array % minValue : Minimum value of any element in array % Write a for loop that iterates from 1 to numberSamples to double any element's % value in dataSamples that is less than minValue dataSamples = userSamples; end 1 2 3 4 5 6 7 8 9 10 Code to call your function
Computers and Technology
1 answer:
ValentinkaMS [17]3 years ago
3 0

Answer:

See explaination for program code

Explanation:

%save as AdjustMinValue.m

%Matlab function that takes three arguments

%called number of samples count, user samples

%and min vlaue and then returns a data samples

%that contains values which are double of usersamples

%that less than min vlaue

%

function dataSamples=AdjustMinValue(numberSamples, userSamples, minValue)

dataSamples=userSamples;

%for loop

for i=1:numberSamples

%checking if dataSamples value at index,i

%is less than minValue

if dataSamples(i)<minValue

%set double of dataSamples value

dataSamples(i)= 2*dataSamples(i);

end

end

end

Sample output:

Note:

File name and calling method name must be same

--> AdjustMinValue(4, [2,12,9,20],10)

ans =

4 12 18 20

You might be interested in
Which statement is true regarding Artificial Intelligence (AI)?
Effectus [21]
Data is the fundamental reason AI succeeds or fails.
This statement is true regarding Artificial Intelligence (AI)
6 0
2 years ago
Every computer consists of physical components and nonphysical components. the nonphysical components of a computer that underst
IrinaVladis [17]
Physical component means Computer Hardware which you can touch and non Physical component means Software, which you can not touch. nonphysical component designed specially for physically component. like Microsoft company designed Software according the Hardware for example Microsoft windows 64 bit could not install on which 32 bit Architecture Hardware.
7 0
3 years ago
write a program that keeps names and email addresses in a dictionary as key-value pairs. the program should display a menu that
erma4kov [3.2K]

To write a program that keeps names and email addresses in a dictionary as key-value pairs check the code given below.

<h3>What is key-value pairs?</h3>

In a key-value pair, two related data elements are combined: a value, which is a variable that belongs to the set (for example, male/female, green, 100), and a key, which is a constant that defines the data set (for example, gender, color, price).

A key-value pair could look something like this when fully formed:

gender = male

color = green

price > 100

↓↓↓//<u>Python code</u>//↓↓↓

import pickle

import sys

try:

   f=open('email.dat','rb')

   d=pickle.load(f)  

   f.close()

     

except:    

   d={}

while True:

   print('\n1. Find a email address')

   print('2. Add name and email address')

   print('3. Change an email address')

   print('4. Delete an email address')

   print('5. Exit\n')

   choice=input('\nEnter a choice: ')

   if choice:

       choice=int(choice)

   else:

       print('\nEnter a number')

       continue    

   if choice == 1:

       while True:

           name=input('\nEnter the name ')

           if name:

               if name in d:

                   print('\n%s is the email id of %s \n' % (d[name],name))

                   break

               else:

                   print('\n Email not found \n')

                   break

           else:

               print('\nName cannot be empty\n')

               continue

           

   elif choice==2:

       while True:            

       

           name=input('\nEnter the name ')

           if name:

               break;

           else:

               print('\nName cannot be empty \n')

               continue

       while True:            

       

           email=input('\nEnter the email address ')

           if email:

               d[name]=email

               break

           else:

               print('\nEmail cannot be empty\n')

               continue

           

   elif choice==3:

       while True:            

       

           name=input('\nEnter the name to change the email address ')

           if name:

               if name in d:

                   email=input('\nEnter the new email address ')

                   d[name]=email

                   print('\nEmail address changed \n')

                   break;

               else:

                   print('\nName not found \n')

                   break

           else:

               print('\nName cannot be empty \n')

               continue

           

   elif choice == 4:

       while True:            

       

           name=input('\nEnter the name to remove ')

           if name:

               if name in d:

                   del d[name]

                   print('\nName and Email address removed \n ')

                   break;

               else:

                   print('\nName not found \n')

                   break

           else:

               print('\nName cannot be empty\n')

               continue

   elif choice == 5:

       

       f=open('email.dat','wb')

       pickle.dump(d,f)

       f.close()

       sys.exit()

   else:

       print('\nEnter a valid choice ')    

Learn more about key-value pair

brainly.com/question/29414672

#SPJ1

3 0
1 year ago
Any Body have a zoom class goin on<br> i wanna bomb
Norma-Jean [14]

This site is only for education related questions. You should only answer or ask questions. That's what we are here for. Whoever is reading this answer, please spread it to stop people from zooming, hurting others, or just posting non-related to education questions. Thank you.

6 0
2 years ago
Give a tight bound on the number of times the z = z + 1 statement is executed. i = 2 while ( i &gt; 1 ) { i = floor(i/2) z = z +
Alinara [238K]

Answer:

zero ( 0) times.

Explanation:

In the code;

i = 2

while ( i > 2){

     i = floor( i/2 );

     z = z + 1;

}

the variable " i " is assigned the integer " 2 ", then the while statement loops with a condition of a greater " i " value and divides the value by two for every loop.

But in this case, the while statement is not executed as the value of " i " which is 2 is not greater than but equal to two.

4 0
2 years ago
Other questions:
  • Which wildcat character will return a single character when using the find dialog box
    14·1 answer
  • Next, determine if the given number is a prime number. A prime number is a number that has no positive divisors other than 1 and
    11·1 answer
  • What is the fundamental problem producers and consumers face?
    12·1 answer
  • What will be the value of i after the C statements at the right have been executed
    6·1 answer
  • Write a programme to find the sum of first three cube number?
    7·1 answer
  • Which technology forms the foundation for cloud computing? forms the foundation for cloud computing.
    12·2 answers
  • Read an integer from keyboard and then print the result of the sum obtained by adding the entered integer to the integer formed
    11·1 answer
  • Which hexadecimal-type address refers to a physical networking device such as a network interface card?
    10·1 answer
  • What is the other name of iterative staatement ​
    13·1 answer
  • The photo shows a group of girls reacting to comments they have read about a classmate on a social media site.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!