Eng 3 Study Guide of Example Problems:))
Eng 3 Study Guide of Example Problems:))
Popular in Course
verified elite notetaker
Popular in Engineering and Tech
This 3 page Bundle was uploaded by Madeline Dippel on Friday April 25, 2014. The Bundle belongs to a course at University of California Santa Barbara taught by a professor in Fall. Since its upload, it has received 247 views.
Reviews for Eng 3 Study Guide of Example Problems:))
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 04/25/14
Hey everyone After looking at the midterm I realized that what is probably the most useful study tool for you guys is to do practice problems So as a study guide I39ll be creating practice problems for you to solve on one page and then on the following page I39ll display my answer and how I got it just in case you get super stuck This will definitely help you come up with working programs quickly come test day There39s only one problem posted now but I39ll be updating this periodically to maximize the help you can get from doing exercises Problem 1 Create a program that adds up all the elements of vector x x1 8 3 9 O 1 do not use the sum function in the program but you can use it to check to see that your program is running correctly After doing that add a line to the program that successively adds the elements of x and puts those elements in a vectorj that39s the same size as x check this answer with the cumsum command Next add a line that computes the sin of each individual element of x Good luck E E j gt Users gt madelinedippel gt Documents gt MATLAB 39 P ltStudent VerSiongt Command Window 2 Editor UsersmadelinedippelDocumentsMATLABextraexercisem X 3 unable to parse command history Line gt Vh 2 isunitarym averagefiterm hw1prob1am hw1prob1bm barnmegaparsecm extraexercisem I 5quot Unable to parse command history line gt 1 x1 3 3 9 9 1 E Unable to parse command history Line eltc 2 w0 Unable to parse command history line gt 3 mn5iZex 4 jzeros1n Student License for use in conjunctio 5 bzero51n degree granting institution Profession 5 for k1n 7 wwxk fl EDUgtgt 8 jkw 9 bksinxk 10 end 11 dispw 12 dispj 13 dispb 14 15 16 17 CurrentFoder i NameA assignm 1 averagefiterm E barnmegaparsecm J extraexercisem 1 extraexercise2m 8 fibonaccim E fibonaccimortm jforloopm h r n lt m IZKIIlCL39L39l39lL II ii lljll Workspace Name A Value Min Max Iocalestruct 1x1 struct Ready script Ln 6 Col 11 Okay so this is my original answer to the question above In hindsight it39s not the most efficient method instead of assigning mn to the size of x I could have used the lengthx function nlengthx However it does display the right answer in the end so I39ll analyze way the function works for you guys Basically to solve this you need to set a variable n where n is equal to the number of elements of x To then add those elements into one sum you need to keep adding all the elements of x together In this case the for loop sets k equal to all the elements of x up to n and then allows you to add all the xk elements into one sum with the equation wwxk In this case its important that you set the value of w0 so that w resets itself each time allowing you to add all the values together For the next part I set a vector j that was the same size as x but composed of all zeros Then in the for loop I replaced those zeros with the value of w j k w What this did was fill in the elements of j with the sum of wxk each time the loop ran allowing each element of j to be a list of the cumulative sums of all the elements of x For the last part I created another vector just like j but called it b For this vector I set each element of b to the value of xk This set each element of b equal to each respective element of x
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'