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

Programming Notes

by: Neha Bhagirath

Programming Notes BE1500

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 4 notes for programmingm, topics include fprintf and scripts and functions
Intro to Programming
Tonya Whitehead
Class Notes
25 ?




Popular in Intro to Programming

Popular in Engineering and Tech

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


Reviews for Programming Notes


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: 06/07/16
  ­last resort, use else statement. Cannot put anything after the “else” expression or it won’t read it    ­only “if” and “end” are needed ­ the “elseif” and and “else” are not NEEDED      >> %Day 7 MATLAB examples  >> a=10;b=15;c=20;  >> x=a<b    x =         1    >> y=a>c||b<c    y =         1    >> %one means yes, zero means no   >> z=a>c&&b<c    z =         0    >> %these are 3 logical operators  >> v=x&y    v =         1    >> %if x is true and y is true, you should get a true for v as well   >> %string compare syntax is "strcmp('Yes','No')  >> %ex. s1='upon';s2={'Once','Upon','A','Time'};tf=strcmp(s1,s2)  >> s1='upon';s2={'Once','Upon','A','Time'};tf=strcmp(s1,s2)    tf =         0     0     0     0    >> %It's comparing each thing and saying yes this is true (1) or no this is false (0)  >> %example below  >> strcmp('Test','test')    ans =         0    >> %the above just asked MATLAB if capitalized test is different than lowercase test and it gave  false because that is not true   >> %examples with if­else statements  ­there are 2 inputs we can use in our script: a string or a number   ­if you put:  strcmp(‘trig,’sine’) it compares your input named ‘trig’ to the sine function, and if you input sine, it  will execute the command          In class exercise:  Answer:    trig=input('Enter a trig function,'s​;%be sure to include the string indicator  x=[0:pi/2:2*pi];%X values for the plot   i strcmp(trig,'sine)%will run if sine is entered      y=sin(x)%creates the y values for the plot       plot(x,y%plots the values of x vs y   elsei strcmp(trig, 'cosine) %will run if cosine is entered      y=cos(x);      plot(x,y),  elsei strcmp(trig,'tangent')%will run if tangent is entered      y=tan(x);      plot(x,y),  else   % runs if none of the other cases are met       disp'Please Try Again'​)  end  titl'Lecture 6 Exercise 1'​)  xlabel('Angle')  ylabel('y axis)        OR       trig=input('Enter A Trig Function: ​s'; %be sure to include the string indicator , the s  x=[0 2*pi];  i trig=='sin(x %put single quotes otherwise it will take sinx as a vector and compare the 'trig'  variable to that      f=@(x)sin(x)      fplot(f,x)  elsei​trig=='cos(x)'      f1=@(x)cos(x)      fplot(f1,x)  else trig=='tan(x)'      f2=@(x)tan(x)      fplot(f2,x)  end      Day 8  ­with a function, you cannot RUN the script. You have to put the first line in the command window  instead  ­the reason we make functions is that we can call chunks of code elsewhere without having to  rewrite it again     ­in the following pic, if you put an elseif, then it’ll look at the ~=, but because you have just an  else, it didn’t even look at what was after the else (also with “otherwise” it won’t look at what is  after that)            Another way of doing an elseif, generally used for strings instead of numbers:    Example:  The ‘s’ is there because it is a string and not a number            Exercise:      BUT you have to make a function so:  ­there is one input and zero output arguments  (now this will make a graph when you type in A1)  (dset is a variable name to indicate something)  (don’t need input since it is a function)        Question:       


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."

Anthony Lee UC Santa Barbara

"I bought an awesome study guide, which helped me get an A in my Math 34B class this quarter!"

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."


"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.