Question: Consider two intervals I1=[a,b] and I2=[c,d]. Write a MATLAB function function [ res ]= IntervalOverlap ( I1, I2) that returns res =1 (true) if intervals

 Consider two intervals I1=[a,b] and I2=[c,d]. Write a MATLAB function function

Consider two intervals I1=[a,b] and I2=[c,d]. Write a MATLAB function function [ res ]= IntervalOverlap ( I1, I2) that returns res =1 (true) if intervals 11 and 12 overlap (i.e. if they have at least one common point) and res =0 (false) otherwise. Use if-else-end selection structure. Note that two intervals can overlap only if at least one of the following conditions is satisfied: a cb,adb,cad,cbd, i.e. if at least one boundary of one interval is inside another interval. Consider input arguments 11 and 12 as arrays, containing coordinates of the interval boundaries. Apply the function for three cases: 1. [a,b]=[2,5],[c,d]=[7,3]. 2. [a,b]=[pi,2pi],[c,d]=[0,3pi/2]. 3. [a,b]=[27,31],[c,d]=[28,29]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!