Matlab for Diff Eq

profilesam8995
lab_1.docx

%% Lab 1 - Your Name - MAT 275

%% Exercise 1

% NOTE: Please suppress output--i.e., use a semicolon ';' at the end of any

% commands for which the output is not necessary to answer the question.

% Delete these notes before turning in.

% Define input variable theta as discretized row vector (i.e., array).

theta = ??;

% Define radius.

r = ??;

% Define x and y in terms of theta and r.

x = ??;

y = ??;

% Check that x and y satisfy the equation of a circle.

%%

% Explain results here. Do x and y satisfy the equation of a circle? Why or

% why not? How does the vector output at the end confirm your answer?

% Notice I did not include text in the same line where the double-comment

% is. What this accomplishes is it does not add a title or create a new

% section in the table of contents when you publish. Using single %

% starting in the line after the %% turns the comments black as opposed to

% green.

%% Exercise 2

% Define t-vector.

t = ??;

% Define y-vector.

%%

% Part (a)

% Plot results (should have 3 plots total).

figure;

plot(??);

title('??')

%%

% Part (b)

% Plot results as data points only and as data points with line.

figure; % creates a new figure window for next plot

plot(??);

title('??')

figure; % creates another figure window

plot(??);

title('??')

%% Exercise 3

% Create t-vector (choose enough elements so that plot is smooth!)

t = ??;

% Define x,y,z components in terms of t.

x = ??; y = ??; z = ??;

% Plot resuls.

figure;

% NOTE: if graph does not look smooth, use more elements in your

% t-vector--i.e., use smaller stepsize between elements. Delete these notes

% before submission.

%% Exercise 4

% Define input variable as vector.

x = ??;

% Define y and z.

y = ??;

z = ??;

% Plot results.

figure;

plot(??)

axis tight;

grid on;

%% Exercise 5

% NOTE: you must create the M-file ex5.m separately and invoke it here in

% your main M-file (main file).

% Print out the code for your created M-file (do NOT submit M-file

% separately).

type 'ex5.m'

% Run your M-file--i.e., execute the M-file.

run 'ex5.m'

%% Exercise 6

% For part (b), you need to create a separate M-file (f.m) and invoke it in

% the main file, here. Erase these notes upon submission.

%%

% Part (a)

% Define f as inline or anonymous function.

f = inline('??');

%%

% Part (b)

% Clear the function f out of the workspace.

% Print out f.m contents.

type 'f.m'

% Evalaute f at x = 2, y = -1.

%% The End!!!