Intro Engineering Programming Assignment 4 Due Monday Octobe

Intro Engineering Programming Assignment #4 Due Monday, October 10th Topples: User Defined Functions and MATLAB Conditionals A mathematician needs you to write a MATLAB Function to verify the format of a four character floating point number input. A valid (4 character) floating point number has the following properties: Consists of exactly four of the following characters: +, -, .(decimal point), and 0 through 9 Either the + or - character may appear only as the first character The.(decimal point) character must appear exactly once All other characters must be the 0 through 9 characters Outline: Create a MATLAB Function m file Establish its name (validate), input (a String), and output (the logical value true or false) Write the necessary MATLAB commands to determine the correct result, using the given input Return the result, by assigning the output variable Make sure to test your function when it is done- You need to write a separate Script file

Solution

function validate=input(x,\'s\')
s=char(A);
k=0;
for i=2:1:4
if(s(i)==\'.\')
k=k+1;
end
  
end
if(s(1)==\'+\'|| s(1)==\'-\')
if(k==1)
validate=1;
else
validate=0;
end
end
  
  

 Intro Engineering Programming Assignment #4 Due Monday, October 10th Topples: User Defined Functions and MATLAB Conditionals A mathematician needs you to write

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site