[x, y] = meshgrid(-pi:0.1:pi, -pi: 0.1:pi); % Define two functions z1 = sin(x) * cos(y); z2 = cos(x) .* sin(y); figure; % Plot the overlayed contours subplot(1,3,1) contour(x, y, z1, 20, 'LineColor', 'b'); % 20 contour lines, blue color hold on; contour(x, y, z2, 20, '--', 'LineColor', 'r'); % 20 contour lines, red color, dashed % Plot the second contour with different line style and color % Add labels and legend title('Overlayed Contour Plot of Two Functions'); legend('sin(x) * cos(y)', 'cos(x) * sin(y)'); hold off; subplot(1,3,2) contourf(x, y, z1, 20, '--', 'LineColor', 'b'); % 20 contour lines, blue color, dashed % Add labels and legend title('Filled Contour of Function 1'); legend('sin(x) * cos(y)'); colorbar; subplot(1,3,3) contourf(x, y, z2, 20, % Add labels and legend 'LineColor', 'r'); % 20 contour lines, red color, dashed title('Filled Contour of Function 2'); legend('cos(x) * sin(y)'); colorbar; Question 1. What type of data format is suitable for contour plotting? Question 2. Please provide two engineering examples that contour plotting is most appropriate for. Please include rationales for your choice.

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
Question

Answer the question using matlab and show your steps & work

[x, y]
=
meshgrid(-pi:0.1:pi, -pi: 0.1:pi);
% Define two functions
z1 = sin(x) * cos(y);
z2 = cos(x) .* sin(y);
figure;
% Plot the overlayed contours
subplot(1,3,1)
contour(x, y, z1, 20, 'LineColor', 'b'); % 20 contour lines, blue color
hold on;
contour(x, y, z2, 20, '--', 'LineColor', 'r'); % 20 contour lines, red color, dashed
% Plot the second contour with different line style and color
% Add labels and legend
title('Overlayed Contour Plot of Two Functions');
legend('sin(x) * cos(y)', 'cos(x) * sin(y)');
hold off;
subplot(1,3,2)
contourf(x, y, z1, 20, '--', 'LineColor', 'b'); % 20 contour lines, blue color, dashed
% Add labels and legend
title('Filled Contour of Function 1');
legend('sin(x) * cos(y)');
colorbar;
subplot(1,3,3)
contourf(x, y, z2, 20,
% Add labels and legend
'LineColor', 'r'); % 20 contour lines, red color, dashed
title('Filled Contour of Function 2');
legend('cos(x) * sin(y)');
colorbar;
Question 1. What type of data format is suitable for contour plotting?
Question 2. Please provide two engineering examples that contour plotting is most appropriate for. Please
include rationales for your choice.
Transcribed Image Text:[x, y] = meshgrid(-pi:0.1:pi, -pi: 0.1:pi); % Define two functions z1 = sin(x) * cos(y); z2 = cos(x) .* sin(y); figure; % Plot the overlayed contours subplot(1,3,1) contour(x, y, z1, 20, 'LineColor', 'b'); % 20 contour lines, blue color hold on; contour(x, y, z2, 20, '--', 'LineColor', 'r'); % 20 contour lines, red color, dashed % Plot the second contour with different line style and color % Add labels and legend title('Overlayed Contour Plot of Two Functions'); legend('sin(x) * cos(y)', 'cos(x) * sin(y)'); hold off; subplot(1,3,2) contourf(x, y, z1, 20, '--', 'LineColor', 'b'); % 20 contour lines, blue color, dashed % Add labels and legend title('Filled Contour of Function 1'); legend('sin(x) * cos(y)'); colorbar; subplot(1,3,3) contourf(x, y, z2, 20, % Add labels and legend 'LineColor', 'r'); % 20 contour lines, red color, dashed title('Filled Contour of Function 2'); legend('cos(x) * sin(y)'); colorbar; Question 1. What type of data format is suitable for contour plotting? Question 2. Please provide two engineering examples that contour plotting is most appropriate for. Please include rationales for your choice.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
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