New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Week 3 Notes for Programming

by: Neha Bhagirath

Week 3 Notes for Programming BE1500

Marketplace > Wayne State University > Engineering and Tech > BE1500 > Week 3 Notes for Programming
Neha Bhagirath

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

These are Week 3 notes for BE 1500 with Professor Tonya Whitehead
Intro to Programming
Tonya Whitehead
Class Notes
programming, computers
25 ?




Popular in Intro to Programming

Popular in Engineering and Tech

This 11 page Class Notes was uploaded by Neha Bhagirath on Tuesday May 31, 2016. The Class Notes belongs to BE1500 at Wayne State University taught by Tonya Whitehead in Spring 2016. Since its upload, it has received 11 views. For similar materials see Intro to Programming in Engineering and Tech at Wayne State University.


Reviews for Week 3 Notes for Programming


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: 05/31/16
  Day 5  ­fprintf­This function is used to format output  ­anything written in single parentheses that becomes a string of text is a string value, or a  numerical value see picture below to see the syntax). Example:     >> y=input('Enter a number')  Enter a number    Or     >> z = input('Enter Text:','s')  Enter Text:      ­Syntax:fprintf(format_string, variables)  ­if you want to use special characters in the string, put ‘/’      In class exercises:        Number 3:      >> untitled5    f =         @(x)(sin(x)).^2+((cos(x)).^2./(sin(x)­cos(x)))    Enter a number    x =         []      Y =         []    >> untitled5    f =         @(x)(sin(x)).^2+((cos(x)).^2./(sin(x)­cos(x)))    Enter a number[0 pi/8 pi/6 pi/4 pi/2]    x =             0    0.3927    0.5236    0.7854    1.5708      Y =       1.0e+15 *       ­0.0000   ­0.0000   ­0.0000   ­4.5036    0.0000    2)    f=@(x)(sin(x)).^2+((cos(x)).^2./(sin(x)­cos(x)))   t=input(‘​Please input a vector of values’​ );  y=f(x)  display(x)  display(y)    ­the thing that makes a function file a function is the word ‘function’ at the start   ­run button will not work for a function file. You have to put inputs       Exercise:  ­Open a new function from the drop down menu   function  [ y ] = Cube_root( x )  %UNTITLED7 Summary of this function goes here  %   Detailed explanation goes here  y=x.^(1/3);   Have to name the file Cube_root as well     End    (what you input is in black)      In the command window:  >> z=Cube_root([8 27 84])    z =        2.0000    3.0000    4.3795      4)    Put in function file:        Put in command window:  >>  untitled10([0 pi/8 pi/6 pi/4 pi/2]) %type untitled10 on your own. Don’t run the script. Save the  above, then input the untitled line and the answers will come    f =         @(x)(sin(x)).^2+((cos(x)).^2./(sin(x)­cos(x)))      ans =       1.0e+15 *       ­0.0000   ­0.0000   ­0.0000   ­4.5036    0.0000        5)   ­­­ use the function and the vector from above, this is a different example    >> g=@(v)5*v+v.^2­v.^3    g =         @(v)5*v+v.^2­v.^3    >> n=1:5:100    n =         1     6    11    16    21    26    31    36    41    46    51    56    61    66    71    76    81    86    91  96    >> untitled12(n,g)    ans =      Columns 1 through 14               5        ­150       ­1155       ­3760       ­8715      ­16770      ­28675      ­45180      ­67035  ­94990     ­129795     ­172200     ­222955     ­282810      Columns 15 through 20         ­352515     ­432820     ­524475     ­628230     ­744835     ­875040    %this is like y=f(x) and you found all the values    Day 6  Table function: used to format data output   Variable names will become column headers   Syntax: table(variable_names)          >> x=1    x =         1    >> fprintf('I had %g cookies\n\n',x)  I had 1 cookies    >> x=12    x =        12    >> y=1/3    y =        0.3333    >> fprintf('I had %g cookies and %f pies\n\n',x,y)  I had 12 cookies and 0.333333 pies    >> fprintf('I had %g cookies and %.2f pies\n\n',x,y)  I had 12 cookies and 0.33 pies    >> x=1:5;    >> y=x.^2;  >> table = [x' y']    table =         1     1       2     4       3     9       4    16       5    25    >> fprintf('%g squared is %g\n\n',x,y)  1 squared is 2    3 squared is 4    5 squared is 1    4 squared is 9    16 squared is 25         


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


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'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Amaris Trozzo George Washington University

"I made $350 in just two days after posting my first study guide."

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.