Question

plotImpulses: consumes the Propulsion Impulse Matrix and the Braking Impulse Matrix. Download the ‘barwitherr.m file from...

plotImpulses:

consumes the Propulsion Impulse Matrix and the Braking

Impulse Matrix. Download the ‘barwitherr.m file from Canvas. This function

plots the impulses in the same style as the above figure using the bar chart

with error bars.

barwitherr

function takes two parameters:

first parameter – 2 X 5 matrix with the

std deviations

of the data

first row - each column is

std deviation

of

propulsion impulses

across all participants

second row - each column is std deviation of

braking impulses

across all participants

second parameter – 2 X 5 matrix with the

averages

of the data

first row - each column is

average

of

propulsion impulses

across all participants

second row - each column is

average

of

braking impulses

across

all participants

You can read the documentation for the bar chart for further information.

You must label your x-axis ticks “Propulsion” and “Braking” corresponding

with the positive and negative data points. You must include the legend for

“Baseline”, “Slow FTM”, “Fast FTM”, “Slow ATM”, and “Fast ATM”. Your Y-axis

must be labeled “Impulses”. Your function should return the plots properties

which can be created by wrapping your call to barwitherr inside of the get()

function.

For Example:

var_name = get(plot(x,y))

0 0
Add a comment Improve this question Transcribed image text
Answer #1
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.chart {
font: 10px sans-serif;
}
.chart rect {
fill: steelblue;
stroke: white;
}
.chart line {
stroke: black;
}
.chart .rule {
fill: #ccc;
}
.chart .label {
fill: white;
}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var data = [4, 8, 15, 16, 23, 42];
var error = 4;
var x = d3.scale.linear()
.domain([0, d3.max(data) + error])
.range([0, 420]);
var y = d3.scale.ordinal()
.domain(data)
.rangeBands([0, 120]);
// SVG
var chart = d3.select("body").append("svg")
.attr("class", "chart")
.attr("width", 440)
.attr("height", 140)
.append("g")
.attr("transform", "translate(10,15)");
// Ticks
chart.selectAll("line.tick") // Lines
.data(x.ticks(10))
.enter().append("line")
.attr("class", "tick")
.attr("x1", x)
.attr("x2", x)
.attr("y1", 0)
.attr("y2", 120)
.style("stroke", "#ccc");
chart.selectAll(".rule") // Line text
.data(x.ticks(10))
.enter().append("text")
.attr("class", "rule")
.attr("x", x)
.attr("y", 0)
.attr("dy", -3)
.attr("text-anchor", "middle")
.text(String);
chart.append("line") // Baseline
.attr("y1", 0)
.attr("y2", 120)
.style("stroke", "#000");
// Bars
chart.selectAll("rect") // Values
.data(data)
.enter().append("rect")
.attr("y", y)
.attr("height", y.rangeBand())
.transition()
.duration(1000)
.attr("width", x);
chart.selectAll("polyline.error") // Error bars
.data(data)
.enter().append("polyline")
.attr("class", "error")
.style("stroke", "#CCC")
.attr("points", function(d){
var x1 = x(d - error)
, x2 = x(d + error)
, ym = y(d) + y.rangeBand() / 2
, yt = ym + y.rangeBand() * 1/3
, yb = ym - y.rangeBand() * 1/3
return "" + x1 + "," + yt + " "
+ x1 + "," + yb + " "
+ x1 + "," + ym + " "
+ x2 + "," + ym + " "
+ x2 + "," + yt + " "
+ x2 + "," + yb + " "
+ x2 + "," + ym + " "
+ x1 + "," + ym + " ";
})
chart.selectAll(".label") // Value Labels
.data(data)
.enter().append("text")
.attr("class", "label")
.attr("x", x)
.attr("y", function(d) {return y(d) + y.rangeBand() / 2; })
.attr("dx", -3)
.attr("dy", ".35em")
.attr("text-anchor", "end")
.text(String);

</script>

hope this creates the horizontal graph you needed

Add a comment
Know the answer?
Add Answer to:
plotImpulses: consumes the Propulsion Impulse Matrix and the Braking Impulse Matrix. Download the ‘barwitherr.m file from...
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
  • MATLAB QUESTION !!! PLEASE USE MATLAB FOR BOTH QUESTIONS!!! THANKS 3) Below is a matrix of...

    MATLAB QUESTION !!! PLEASE USE MATLAB FOR BOTH QUESTIONS!!! THANKS 3) Below is a matrix of random numbers. Find the mean, median, and mode of the matrix. B=[0 1 2 3 4 50689 23092 6 8 407] Sort Matrix Z so that the largest numbers of each row are in the first column and smallest numbers descend towards the last column. Must use sort function. 4) Create a matrix X so that the first row has values from 0 to...

  • what is a good matlab code to out put this matrix from question 1 to 3...

    what is a good matlab code to out put this matrix from question 1 to 3 HITA 1)-The general form cf the quadratic equation is a +bx+c 0 Wrte a MATLAB function named quadratic that finds the two roots of this equation and x when given the coeficients a, b and c 2)-Create a random matrix A in MATLAB with 6 rows and 3 oolumns using the rand) function 3)-Now modify quadratic by so that il can take each row...

  • problem2, the file "Test_Data.xlsx" contains in cylinder pressure data from a firing engine. the data is...

    problem2, the file "Test_Data.xlsx" contains in cylinder pressure data from a firing engine. the data is resolved in crank angle degree and is taken every 1/2 degree. O tittps/ualearn blackboard.com/bbcswebdav/pid plot a new function on the same graph overwriting the orizinal function 1 of11ρ Functions to choose from: y A sin(Bx C)+ D y A sin2(Bx+ C) + D y A In(Bx + C)D y A exp(Bx + C)+ D ž. The file "Test Data.xlsx" contains in-cylinder pressure data from...

  • Problem 1 Write your code in the file MatrixOps.java. . Consider the following definitions from matrix...

    Problem 1 Write your code in the file MatrixOps.java. . Consider the following definitions from matrix algebra: A vector is a one-dimensional set of numbers, such as [42 9 20]. The dot product of two equal-length vectors A and B is computed by multiplying the first entry of A by the first entry of B, the second entry of A by the second entry of B, etc., and then summing these products. For example, the dot product of [42 9...

  • Python Programming language. Complete the problems below using Jupyter Notebook. Problem Needs to be solved from...

    Python Programming language. Complete the problems below using Jupyter Notebook. Problem Needs to be solved from number #1 link provided for the Data: -----> https://docs.google.com/spreadsheets/d/1TqhyxFKQlOHAyXpQBL-4C96kgZFBoMwUgE8-b33CqPQ/edit?usp=sharing PROBLEMS # 0.0 Import the libraries (pandas, matplotlib, and seaborn) Include the code line: %matplotlib inline #Include the code line: plt.style.use(“ggplot”) #Load the data using pandas #Inspect the data using head(), dtypes ANSWERD: import pandas as pd import matplotlib.pyplot as plt import seaborn as sns plt.style.use('ggplot') %matplotlib inline df = pd.read_csv() print(df.head()) print(df.dtypes) # 1...

  • My Company Projected Budget - 2019 Expense Category 1st Qtr. 2nd Qtr. 3rd Qtr. 4th Qtr....

    My Company Projected Budget - 2019 Expense Category 1st Qtr. 2nd Qtr. 3rd Qtr. 4th Qtr. Annual Total Average Minimum % of Total Rent 2800 2800 3000 3000 Electric 700 500 500 800 Phone 300 300 300 300 Supplies 800 600 600 500 Payroll 6000 9000 12000 12000 Total Average Maximum  Create a new workbook in Excel  Save workbook as “yourinitialsBUDGET” (replace “yourinitials” with your initials)  Insert a row between PHONE and SUPPLIES and Enter the following:...

  • I only need the "functions" NOT the header file nor the main implementation file JUST the impleme...

    I only need the "functions" NOT the header file nor the main implementation file JUST the implementations for the functions Please help, if its difficult to do the complete program I would appreciate if you could do as much functions as you can especially for the derived class. I am a beginer so I am only using classes and pointers while implementing everything using simple c++ commands thank you in advanced Design and implement two C++ classes to provide matrix...

  • I need this written in C++. Magic Squares. An n x n matrix that is filled...

    I need this written in C++. Magic Squares. An n x n matrix that is filled with the numbers 1,2,3,…,n2 is a magic square if the sum of the elements in each row, in each column, and in the two diagonals is the same value. The following algorithm will construct magic n x n squares; it only works if n is odd: Place 1 in the middle of the bottom row. After k has been placed in the (i,j) square,...

  • C++ Magic Squares. An n x n matrix that is filled with the numbers 1,2,3,…,n2 is...

    C++ Magic Squares. An n x n matrix that is filled with the numbers 1,2,3,…,n2 is a magic square if the sum of the elements in each row, in each column, and in the two diagonals is the same value. The following algorithm will construct magic n x n squares; it only works if n is odd: Place 1 in the middle of the bottom row. After k has been placed in the (i,j) square, place k+1 into the square...

  • C++ CODE: The matrix class consists of two files: matrix.h and matrix.cpp. The class has the...

    C++ CODE: The matrix class consists of two files: matrix.h and matrix.cpp. The class has the following definition: matrix -size:int -mat:int** ---------------- +matrix(file:string) +~matrix() +operator +(add:matrix*):matrix & +operator-(sub:matrix*):matrix & +friend operator<<(out:ostream &, t:const matrix&):ostream & +displayRow(r:int):void The class variables are as follows: • size: the number of rows and columns in a square matrix • mat: the integer matrix that contains the numeric matrix itself. The methods have the following behaviour: 2 • matrix(file:string): The default constructor. It receives the...

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