I need help with MATLAB programming. I have create 2 matrices eta_1 and eta_2 from eta1 and eta2. I am trying to intersect each column of eta_1 with each column of eta_2 as you can see in the last for loop. But the code only lets me intersect until the index hits 4. At index 5 it shows an error. I don't know why it would work for the first four indeces and stop at i = 5. Can you help me fix it?   eta1 = [135.3767  136.7215  138.0672  139.4093  140.7436  142.0707  143.3915  144.7063  146.0159]; eta2 = [-44.6233  -43.2785

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I need help with MATLAB programming. I have create 2 matrices eta_1 and eta_2 from eta1 and eta2. I am trying to intersect each column of eta_1 with each column of eta_2 as you can see in the last for loop. But the code only lets me intersect until the index hits 4. At index 5 it shows an error. I don't know why it would work for the first four indeces and stop at i = 5. Can you help me fix it?

 

eta1 = [135.3767  136.7215  138.0672  139.4093  140.7436  142.0707  143.3915  144.7063  146.0159];
eta2 = [-44.6233  -43.2785  -41.9328  -40.5907  -39.2564  -37.9293  -36.6085  -35.2937  -33.9841];

% For cos
eta_1 = [abs(eta1); 360-abs(eta1)];

% For sin
for i = 1:length(eta2) % Fix the loop indexing

    if 0 <= eta2(i) && eta2(i) <= 180
        eta_2(1,i) = eta2(i);
        eta_2(2,i) = 180 - eta2(i);

    elseif 180 < eta2(i) && eta2(i) <= 360
        eta_2(1,i) = eta2(i); 
        eta_2(2,i) = 360 - (eta2(i) - 180);
    
    elseif -360 < eta2(i) && eta2(i) <= -180 
        eta_2(1,i) = 360 + eta2(i);
        eta_2(2,i) = 180 - (360 + eta2(i));
    
    elseif -180 < eta2(i) && eta2(i) <= 0
        eta_2(1,i) = 360 + eta2(i);
        eta_2(2,i) = 360 - (180 - eta2(i));
   
    end

end

eta_1
eta_2


for i = 1:length(eta_1)
    eta(i) = intersect(eta_1(:,i), eta_2(:,i))

end

Expert Solution
steps

Step by step

Solved in 6 steps with 4 images

Blurred answer
Knowledge Booster
Time complexity
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education