Question

MATLAB EXPERT PLS HELP!!! SHORT AND SIMPLE QUESTIONS! Just write the code to do the following...

MATLAB EXPERT PLS HELP!!! SHORT AND SIMPLE QUESTIONS!

Just write the code to do the following operations step by step please. You dont need background info on the question

  1. Prompt the user to enter x and if x is less than 2 or not an integer, use a while loop to display “Invalid!” and prompt the user to re-enter valid entries.
  2. Prompt the user to enter y as a vector of x elements. If the user did not enter in a vector containing at least 3 elements, use a while loop to display “Invalid!” and prompt the user to re-enter a valid vector
  3. Print a menu showing options: 1 for temperature, 2 for heat flux, 3 for insulated, and 4 for convective.
  4. Prompt the user to enter N as an integer number 1,2,3 or 4 and if the user didn’t enter a valid entry us a while loop to display “Invalid!” and prompt the user to enter a valid entry.
  5. Based on the chosen value for N, prompt the user to enter to enter the remaining information:
  • Temperature
  • Heat Flux
  • Convective: heat transfer coefficient in W/m2K and the outside temperature in Celcius
  1. Prompt the user to enter p as a number. If the user did not enter in a valid option, use a while loop to display “Invalid entry!” and prompt the user to re-enter a valid option.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

x=input('Enter x value : ')

f=1
% to validate x
while f
if (x>2) & (floor(x)==x)
f=0
else
disp('Invalid ')
x=input('Enter x value : ')
end
end
  

% to validate y
f=1
y=input('Enter y as a vector of x elements : ')
while f
if length(y)>=3
f=0;
else
disp('Invalid ')
y=input('Enter y as a vector of x elements : ')
end
end

disp('1 for temperature')
disp('2 for heat flux')
disp('3 for insulated ')
disp(' 4 for convective')

N=input('Enter N as an integer number 1,2,3 or 4 ')


% to validate N
f=1;
while f
if N>=1 & N<=4
f=0;
else
disp('Invalid ')
N=input('Enter N as an integer number 1,2,3 or 4 : ')
end
end

f=1;

p=input(' enter p as a number : ')
  
% to validate p
while f
if isnumeric(p)
f=0;
else
disp('Invalid ')
p=input(' enter p as a number : ')
end
end
  


  
  

Add a comment
Know the answer?
Add Answer to:
MATLAB EXPERT PLS HELP!!! SHORT AND SIMPLE QUESTIONS! Just write the code to do the following...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • MATLAB help! I have some MATLAB Assignment to do, the proffesor requires all the small parts...

    MATLAB help! I have some MATLAB Assignment to do, the proffesor requires all the small parts in order to get full credit. Help me out, thank you f LAB SECTION NAME HW6P3 (30 points) following are infinite series representations of the function, un pra i a script file HW6P3 that determines the value of the function from the sum of the series for a given value of x. The program (1 pt) must prompt the user to enter a value...

  • C++ programming For this assignment, write a program that will act as a geometry calculator. The...

    C++ programming For this assignment, write a program that will act as a geometry calculator. The program will be menu-driven and should continue to execute as long as the user wants to continue. Basic Program Logic The program should start by displaying a menu similar to the following: Geometry Calculator 1. Calculate the area of a circle 2. Calculate the area of a triangle 3. Quit Enter your choice(1-3): and get the user's choice as an integer. After the choice...

  • This is a matlab HW that I need the code for, if someone could help me figure this out it would b...

    This is a matlab HW that I need the code for, if someone could help me figure this out it would be appreciated. The value of t can be estimated from the following equation: in your script file, estimate the value of π for any number of terms. You must ask the user for the desired number of terms and calculate the absolute error/difference between your calculation and the built-in MATLAB value ofpi. Display your results with the following message...

  • Write MIPS code, please. Following: Write a program to be used by the Wisconsin DNR to...

    Write MIPS code, please. Following: Write a program to be used by the Wisconsin DNR to track the number of Deer Hunting Licenses issued in a county and the state. It will display a menu with 5 choices numbered 1-5. They are (1) update the count, (2) display the number of licenses already issued to a county whose number is input, (3) display the county number and the number of licenses already issued to a range of counties whose starting...

  • Write a C program code for the scenerio below: An important device carried up to the...

    Write a C program code for the scenerio below: An important device carried up to the International Space Station on the last scheduled flight of space shuttle Endeavor was the Alpha Magnetic Spectrometer (AMS-02). As explained by NASA, the AMS is a particle physics detector, searching for antimatter and dark matter and also measuring cosmic rays. The name strangelets refers to three types of quarks (named u, d or s) which have been discovered experimentally to make up matter, but...

  • Write a program(Python language for the following three questions), with comments, to do the following:   ...

    Write a program(Python language for the following three questions), with comments, to do the following:    Ask the user to enter an alphabetic string and assign the input to a variable str1. Print str1. Check if str1 is valid, i.e. consists of only alphabetic characters. If str1 is valid Print “<str1> is a valid string.” If the first character of str1 is uppercase, print the entire string in uppercase, with a suitable message. If the first character of str1 is...

  • The name of the C++ file must be search.cpp Write a program that will read data...

    The name of the C++ file must be search.cpp Write a program that will read data from a file. The program will allow the user to specify the filename. Use a loop that will check if the file is opened correctly, otherwise display an error message and allow the user to re-enter a filename until successful. Read the values from the file and store into an integer array. The program should then prompt the user for an integer which will...

  • Write a complete C++ program that do following. 1) Read a positive integer from the user...

    Write a complete C++ program that do following. 1) Read a positive integer from the user with proper prompt. Assume that this user is nice and he/she would not start the integer with digit 0. 2) Create a size 10 array as counters for digits 0 - 9. 3) Use a while loop for processing a) Single out the current last digit using modular 10 technique b) Increment the corresponding counter through the index derived in a). 4) At the...

  • Could I get some help with the following Task? The program should be implemented in JavaScript and running on Firefox, a web browser independent to operating systems. The client has specified the foll...

    Could I get some help with the following Task? The program should be implemented in JavaScript and running on Firefox, a web browser independent to operating systems. The client has specified the following requirements for the functionality of the program: 1. The program should be running without errors throughout two Phases: Information Gathering and Information Presenting. 2. Information Gathering is to gather the information such as state/territory name, the population and population change over previous year for calculation of APG;...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT