% This M-file will serve as an example for how you should compose
% your homework script files.
% For each script you must privide a "header" which describes in detail
% what the script is meant to do and how to use it. Anytime you want to
% write comments within your script you need to place a "%" at the start
% of the line so MATLAB knows not to execute what you've typed.
% Script PS1_p4.m
% This script executes the equations given in problem #2 of PS1
% Always a good idea to start w/a clean slate so before typing any commands
% it's always a good idea to
% Now we'll start the script file
% The first thing we need to do is assign values for consants
% If you forget to put a ";" at the end of your command then, just
% like at the command line, MATLAB will echo the result.
t = 2.5; x = 4.3; y = 15.25; z = 8.2;
% Evaluate expressions M,N,O,P from problem #2
M = 4*x^2 + 3*y + 10;
N = exp(2*x) + x;
O = sqrt(1/(x+y) + 1/(t+z));
P = 4*exp(-x/2)*sin(pi*x);
Click here to go back to core lesson 1.