Question
% PA 08: 3D Plots, Files, Functions
% Using the script provided and the functions provided, complete the code
% to be able to plot specified graphs. Script file contains a menu of
% choices where user will select which plot to produce.
% Functions contain the necessary code to plot. Please note that functions
% do NOT take any arguments and do NOT return anything.
% You are provided with two MS Excel files that you must use to get the
% data to plot for functions plot3d and bar3d.

choice = ?;

while choice ~= ?
  
choice = menu('3D Plots', ' Parametric 3D Plot ', 'Bar 3D Plot', 'Exit')
  
% add function calls here
switch choice
case 1
?;
case 2
?;
case 3
close all;
end
  
end

%-------------------------------------------------------------------------
% Propeller 3D curve
% We will represent a propeller as a parametric curve (instead of defining y
% in terms of x (y = f(x)) or x in terms of y (x=h(y)) we define both
% x and y in terms of a third variable called a parameter as follows:
% x = f(t), y = g(t))

function plot3d()

clf % clear current figure

% Get vector t, the parameter, from tdata.xlsx

?


% 3D plot, 3 coordinates, blue line
?(?, sin(t), cos(t), 'b-');
title('Helice')
xlabel('X axis'), ylabel('Y axis'), zlabel('Z axis')

% to plot two figures on same graph
?

% 2nd propeller, rotating in other direction
?(?, sin(t), -cos(t), 'k-');

end

%------------------------------------------------------------------------
% Boston area temperature data for years 1900-2000
%
function bar3d()
clf

% get data from the file
?

% Select specific data from file to display axis ticklabel
?

% Delete unnecessary data

?
% Create the 3D bar chart
bar3(?)

% axis([XMIN XMAX YMIN YMAX ZMIN ZMAX]) sets the scaling for the
% x-, y- and z-axes on the current 3-D plot.
axis([0 13 0 12 0 80])

% Add title and axis labels
title('Boston Monthly Temperatures 1900-2000')
xlabel('Month')
ylabel('Year')
zlabel('Temperature')



%Change the x and y axis tick labels
set(gca, 'XTickLabel', months)
set(gca, 'YTickLabel', years)
end
------------------------------------
tdata xlsx file

Range Values, t
-6.283185307
-6.233185307
-6.183185307
-6.133185307
-6.083185307
-6.033185307
-5.983185307
-5.933185307
-5.883185307
-5.833185307
-5.783185307
-5.733185307
-5.683185307
-5.633185307
-5.583185307
-5.533185307
-5.483185307
-5.433185307
-5.383185307
-5.333185307
-5.283185307
-5.233185307
-5.183185307
-5.133185307
-5.083185307
-5.033185307
-4.983185307
-4.933185307
-4.883185307
-4.833185307
-4.783185307
-4.733185307
-4.683185307
-4.633185307
-4.583185307
-4.533185307
-4.483185307
-4.433185307
-4.383185307
-4.333185307
-4.283185307
-4.233185307
-4.183185307
-4.133185307
-4.083185307
-4.033185307
-3.983185307
-3.933185307
-3.883185307
-3.833185307
-3.783185307
-3.733185307
-3.683185307
-3.633185307
-3.583185307
-3.533185307
-3.483185307
-3.433185307
-3.383185307
-3.333185307
-3.283185307
-3.233185307
-3.183185307
-3.133185307
-3.083185307
-3.033185307
-2.983185307
-2.933185307
-2.883185307
-2.833185307
-2.783185307
-2.733185307
-2.683185307
-2.633185307
-2.583185307
-2.533185307
-2.483185307
-2.433185307
-2.383185307
-2.333185307
-2.283185307
-2.233185307
-2.183185307
-2.133185307
-2.083185307
-2.033185307
-1.983185307
-1.933185307
-1.883185307
-1.833185307
-1.783185307
-1.733185307
-1.683185307
-1.633185307
-1.583185307
-1.533185307
-1.483185307
-1.433185307
-1.383185307
-1.333185307
-1.283185307
-1.233185307
-1.183185307
-1.133185307
-1.083185307
-1.033185307
-0.983185307
-0.933185307
-0.883185307
-0.833185307
-0.783185307
-0.733185307
-0.683185307
-0.633185307
-0.583185307
-0.533185307
-0.483185307
-0.433185307
-0.383185307
-0.333185307
-0.283185307
-0.233185307
-0.183185307
-0.133185307
-0.0831853072
-0.0331853072
0.0168146928
0.0668146928
0.116814693
0.166814693
0.216814693
0.266814693
0.316814693
0.366814693
0.416814693
0.466814693
0.516814693
0.566814693
0.616814693
0.666814693
0.716814693
0.766814693
0.816814693
0.866814693
0.916814693
0.966814693
1.016814693
1.066814693
1.116814693
1.166814693
1.216814693
1.266814693
1.316814693
1.366814693
1.416814693
1.466814693
1.516814693
1.566814693
1.616814693
1.666814693
1.716814693
1.766814693
1.816814693
1.866814693
1.916814693
1.966814693
2.016814693
2.066814693
2.116814693
2.166814693
2.216814693
2.266814693
2.316814693
2.366814693
2.416814693
2.466814693
2.516814693
2.566814693
2.616814693
2.666814693
2.716814693
2.766814693
2.816814693
2.866814693
2.916814693
2.966814693
3.016814693
3.066814693
3.116814693
3.166814693
3.216814693
3.266814693
3.316814693
3.366814693
3.416814693
3.466814693
3.516814693
3.566814693
3.616814693
3.666814693
3.716814693
3.766814693
3.816814693
3.866814693
3.916814693
3.966814693
4.016814693
4.066814693
4.116814693
4.166814693
4.216814693
4.266814693
4.316814693
4.366814693
4.416814693
4.466814693
4.516814693
4.566814693
4.616814693
4.666814693
4.716814693
4.766814693
4.816814693
4.866814693
4.916814693
4.966814693
5.016814693
5.066814693
5.116814693
5.166814693
5.216814693
5.266814693
5.316814693
5.366814693
5.416814693
5.466814693
5.516814693
5.566814693
5.616814693
5.666814693
5.716814693
5.766814693
5.816814693
5.866814693
5.916814693
5.966814693
6.016814693
6.066814693
6.116814693
6.166814693
6.216814693
6.266814693
-----------------------------
bar3data xlsx file

MONTHS YEARS TEMPS
Jan 1900 30.1 29.3 34 48.5 55.2 68.6 73.9 71.1 64.9 56.6 44.7 33.5
Feb 1910 32 29.5 42 51.6 57.6 65.2 74.9 68.8 62.8 56 41.2 27.5
Mar 1920 21 27.6 39.3 45.1 54.6 65.8 72.4 72 65.2 59.8 41.7 35.6
Apr 1930 31.8 34.1 38.3 47.6 59.4 72.4 72.6 70.5 69.4 53 45.1 33.2
May 1940 23 29.6 33.1 43.6 56.3 65.1 71.5 68.5 63.3 50.6 42.9 34.3
Jun 1950 36.2 28 33.7 46.8 55.8 69.1 73.5 70.8 61.5 56.3 47.8 35.5
Jul 1960 30.9 35.3 32.7 48.3 59.7 69.6 73.1 72.2 63.7 53.9 48 29.5
Aug 1970 23 32.3 37.4 49 59.6 67 74.2 73.6 65.6 54.9 44.8 28.9
Sep 1980 29.4 27.8 36.8 48.7 59.4 66.3 75.8 74.2 66.9 52.4 41.2 28.6
Oct 1990 36.4 34.1 40.1 47.6 54.9 66.6 73.1 73.3 64.6 58.3 48.5 40.7
Nov 2000 27.5 34.2 43.3 47.3 57.2 67.3 70 70.3 63.5 53.9 43.8 29.2
Dec
-------------------

MONTS YEARS 00 EMPS 552 57 Jan 293 34 49 447 33.5 452 1910 321 295 42 514 42 412 27.5 2 1920 21 26 393 $46 455 724 52 417 356
a Ya daa a 38T a 4 4aa 4sMatMT 4MAY 45 4aaT 44 43a 4a 428 AUsae 4tcae ana hca sacate az JUsaN 2 28 24a 1aT 4 44a 3a 12 aa 4TI
Using the template provided, complete the code to be able to plot specified graphs. Script file contains a menu of choices wh
Using the template provided, complete the code to be able to plot specified graphs. Script file contains a menu of choices wh

Matlab Language
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

Note: Since the excel data is provided in the question, so, it is not being provided in the answer.

Program code screen shot:

% PA 08: 3D Plots, Files, Functions % Using the script provided and the functions provided, complete the code % to be able to

plot3d.m

Propeller 3D curve % We will represent a propeller as a parametric curve % in terms of x (y = f(x)) or x in terms of y (x=h (

bar3d.m

% Boston area temperature data for years 1900-2000 bar3d () function [] clf % get data from the file [num, txt, temperaturesD

Sample output:

3D Plots Parametric 3D Plot Bar 3D Plot Exit n X

Select Parametric 3D Plot:

Figure1 X File Edit View Insert Tools Desktop Window Help Helice 0.5 -0.5 -1 0.5 10 5 0 0 -0.5 -5 Y axis -1 -10 Х axis Z axis

Now, Select the Bar 3D Plot:

3D Plots Parametric 3D Plot Bar 3D Plot Exit n X

Figure 1 File Edit View Insert Tools Desktop Window Help Boston Monthly Temperatures 1900-2000 80 60 20 ఆి రిరర్రర్కలా JafebM

Program code to copy:

% PA 08: 3D Plots, Files, Functions

% Using the script provided and the functions provided, complete the code

% to be able to plot specified graphs. Script file contains a menu of

% choices where user will select which plot to produce.

% Functions contain the necessary code to plot. Please note that functions

% do NOT take any arguments and do NOT return anything.

% You are provided with two MS Excel files that you must use to get the

% data to plot for functions plot3d and bar3d.

choice = 1;

while choice ~= 0

    choice = menu('3D Plots', ' Parametric 3D Plot ', 'Bar 3D Plot', 'Exit')

    % add function calls here

    switch choice

        case 1

            plot3d();

        case 2

            bar3d();

        case 3

            close all;

    end

end

%-------------------------------------------------------------------------

% Propeller 3D curve

% We will represent a propeller as a parametric curve (instead of defining y

% in terms of x (y = f(x)) or x in terms of y (x=h(y)) we define both

% x and y in terms of a third variable called a parameter as follows:

% x = f(t), y = g(t))

function[]= plot3d()

    clf % clear current figure

   

    % Get vector t, the parameter, from tdata.xlsx

    [num, txt,t] = xlsread('tdata.xlsx')

   

    t(1)=[];

    t = cell2mat(t);

   

    % 3D plot, 3 coordinates, blue line

    fplot3(t, sin(t), cos(t), 'b-');

    title('Helice')

    xlabel('X axis'), ylabel('Y axis'), zlabel('Z axis')

   

    % to plot two figures on same graph

    hold on

   

    % 2nd propeller, rotating in other direction

    flot3(t, sin(t), -cos(t), 'k-');

end

%------------------------------------------------------------------------

% Boston area temperature data for years 1900-2000

%

function [] = bar3d()

clf

% get data from the file

[num, txt, temperaturesData] = xlsread('bar3data.xlsx');

temperatures = xlsread('bar3data.xlsx', 'C2:N12');

% % Select specific data from file to display axis ticklabel

years = temperaturesData(:,2);

months = txt(:,1);

% % Delete unnecessary data

years(1)=[];

years(end)=[];

months(1) = [];

% % Create the 3D bar chart

bar3(temperatures)

% axis([XMIN XMAX YMIN YMAX ZMIN ZMAX]) sets the scaling for the

% x-, y- and z-axes on the current 3-D plot.

axis([0 13 0 12 0 80])

% Add title and axis labels

title('Boston Monthly Temperatures 1900-2000')

xlabel('Month')

ylabel('Year')

zlabel('Temperature')

%Change the x and y axis tick labels

set(gca, 'XTickLabel', months)

set(gca, 'YTickLabel', years)

end

Add a comment
Know the answer?
Add Answer to:
% PA 08: 3D Plots, Files, Functions % Using the script provided and the functions provided,...
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
  • Using the template code provided in the braille translator.py file as a starting point, complete functions...

    Using the template code provided in the braille translator.py file as a starting point, complete functions enocode and decode that convert alphabets back and forth between normal English and English Braille. OOOOOOOO. • • • mn Op W X Y Z (Modified from: https://en.wikipedia.org/wiki/English_Braille) Figure 1: The various Braille alphabets. The above table shows the various Braille alphabets corresponding to English alphabets a-z. Each Braille alphabet is represented as a 3 x 2 matrix (three rows and two columns). The...

  • For this project, each part will be in its oun matlab script. You will be uploading a total 3 m f...

    For this project, each part will be in its oun matlab script. You will be uploading a total 3 m files. Be sure to make your variable names descriptive, and add comments regularly to describe what your code is doing and hou your code aligns with the assignment 1 Iterative Methods: Conjugate Gradient In most software applications, row reduction is rarely used to solve a linear system Ar-b instead, an iterative algorithm like the one presented below is used. 1.1...

  • Assignment Predator / Prey Objectives Reading from and writing to text files Implementing mathematical formulas in...

    Assignment Predator / Prey Objectives Reading from and writing to text files Implementing mathematical formulas in C++ Implementing classes Using vectors Using command line arguments Modifying previously written code Tasks For this project, you will implement a simulation for predicting the future populations for a group of animals that we’ll call prey and their predators. Given the rate at which prey births exceed natural deaths, the rate of predation, the rate at which predator deaths exceeds births without a food...

  • 23.4 Project 4: Using Pandas for data analysis and practice with error handling Python Please! 23.4...

    23.4 Project 4: Using Pandas for data analysis and practice with error handling Python Please! 23.4 PROJECT 4: Using Pandas for data analysis and practice with error handling Overview In this project, you will use the Pandas module to analyze some data about some 20th century car models, country of origin, miles per gallon, model year, etc. Provided Input Files An input file with nearly 200 rows of data about automobiles. The input file has the following format (the same...

  • Here I am asked to create a program using functions and files in python 3.7. I...

    Here I am asked to create a program using functions and files in python 3.7. I am unfortunately not able to use lists in the project. Thanks CSE 231 Fall 2019 Programming Project 05 This assignment is worth 45 points (4.5% of the course grade) and must be completed and turned in before 11:59 PM on Monday, October 14, 2019. Assignment Overview 1. Functions 2. File input and output 3. try-except Computational facial recognition is growing. Starting with the iPhone...

  • 1) a) Write MATLAB function that accepts a positive integer parameter n and returns a vector...

    1) a) Write MATLAB function that accepts a positive integer parameter n and returns a vector containing the values of the integral (A) for n= 1,2,3,..., n. The function must use the relation (B) and the value of y(1). Your function must preallocate the array that it returns. Use for loop when writing your code. b) Write MATLAB script that uses your function to calculate the values of the integral (A) using the recurrence relation (B), y(n) for n=1,2,... 19...

  • write MATLAB scripts to solve differential equations. Computing 1: ELE1053 Project 3E:Solving Differential Equations Project Principle...

    write MATLAB scripts to solve differential equations. Computing 1: ELE1053 Project 3E:Solving Differential Equations Project Principle Objective: Write MATLAB scripts to solve differential equations. Implementation: MatLab is an ideal environment for solving differential equations. Differential equations are a vital tool used by engineers to model, study and make predictions about the behavior of complex systems. It not only allows you to solve complex equations and systems of equations it also allows you to easily present the solutions in graphical form....

  • matlab 1. [suDmit as Iwo JPEGS in Canvas with your netiD in the title of each...

    matlab 1. [suDmit as Iwo JPEGS in Canvas with your netiD in the title of each plot] An electricity startup is looking into the viability of putting solar panels on the rooftops of buildings in Newark, NJ. They want you to help them come up with visualizations for data they have from the National Renewable Energy Laboratory and the National Oceanic and Atmospheric Administration about: - The average amount of sunshine received each month in the form of Global Horizonal...

  • The following are screen grabs of the provided files Thanks so much for your help, and have a n...

    The following are screen grabs of the provided files Thanks so much for your help, and have a nice day! My Java Programming Teacher Gave me this for practice before the exam, butI can't get it to work, and I need a working version to discuss with my teacher ASAP, and I would like to sleep at some point before the exam. Please Help TEST QUESTION 5: Tamagotchi For this question, you will write a number of classes that you...

  • The both files are included. Where are these which are colorful. Point.h and point.cpp Hor this assignment you are provided the files for a class called point. Download the h and .cpp files and incl...

    The both files are included. Where are these which are colorful. Point.h and point.cpp Hor this assignment you are provided the files for a class called point. Download the h and .cpp files and include them in your project. IheじML diagram below details the class Point くくfriend>> ostream& operator.((ostream&, point&) <ごfriend::. İstream& operator:..イ1stream&-point& - : double - v doublc getX) double getYO double - sctX( double): void - set Y(double) : void - point(double-0.0, double-0.0 operator-(const point& bool perator< const...

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