Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

answer the code % % - - - - - - - - - - - - - - - - - - - -

answer the code %%---------------------------------------------------------------
%...*****CEE210 Computing Project 1- Getting to Know MATLAB *****
%...Name: TYPE YOUR NAME HERE
%...Date: Type the date of submittal here
%...Recitation Section:
%-----------------------------------------------------------------
clear; clc; %Clear the workspace and command window
%%---------------------------------------------------------------
% Part 1
% Set up 4 variables and compute five results
%-----------------------------------------------------------------
disp('Part 1'); %output to command window
Variable1=2%CREATE YOUR OWN VARIABLE NAMES
Variable2=%Again, use your own variable names
%continue this section
%Create output for the command window
fprintf('%s%4i
',' Addition: ',Variable1)
fprintf('%s%4i
',' Division: %complete this command and continue
% WHAT DOES THE 's','i', and 'n' DO IN THE fprintf COMMAND?
% WHAT HAPPENS TO THE OUTPUT IF YOU PUT A SEMI-COLON AFTER THE CALC?
% IS THE COS CALCULATED IN DEGREES OR RADIANS?
% HOW CAN YOU GET THE OTHER ONE (DEGREES OR RADIANS)?
%%---------------------------------------------------------------
% Part 2
% Set up 3 matrices and perform five matrix computations
%-----------------------------------------------------------------
disp('Part 2'); %output to command window
MatrixA =[]; %Again, use your own variable names
%continue this section
% CAREFULLY CONSIDER THE MATRIX ALGEBA THAT HAPPENS HERE.
%%---------------------------------------------------------------
% Part 3
% Use nested for loops to store a series of values in an 2-D array
% The user must have input for the number series.
%-----------------------------------------------------------------
disp('Part 3'); %output to command window
startvalue = input ('Enter a real number for the starting value of your series. ');
= input % complete this command, and the rest in this part
size = input ('Enter a positive integer
value = startvalue;
= zeros(size,size); % initialize the size x size matrix
% This is where you insert a pair of nested for loops to fill in the
% correct values in the matrix.
% display the completed matrix to the command window
%%---------------------------------------------------------------
% Part 4
% Use 'linspace' arrays to create plots of the given functions with
% specific number of steps.
%-----------------------------------------------------------------
disp('Part 4'); %output to command window
% Create an array of 'x' values with a specific number of evenly (or
% linearly) spaced points.
% Then use that to calculate an array of corresponding 'y' values and plot
% x vs. y.
% Notice one function starts at x=0 but the other function starts at x=1.
% Create the arrays and function values here.
x1start =0;
steps1=20;
x1end =20;
x1= linspace(%complete this command, and the rest of this part.
y1=
x2start =
x2= linspace(
%Create the plot
fig = figure(1); clf; grid on; hold on;
xlabel('x'); ylabel('y'); title('Part 4- Linspace Array Calcs');
p = plot(x1, y1);
set(p, 'Color','red', 'LineWidth',2);
p = plot(x2, y2);
set(p, 'Color','blue', 'LineWidth',3);
legend('Function 1', 'Function 2', 'Location', 'northwest');
% HOW MANY 'STEPS' WERE TAKEN FOR EACH FUNCTION?
% HOW MANY POINTS (x,y data pairs) WERE CREATED FOR EACH FUNCTION?
% WHAT WAS THE STEP SIZE FOR EACH FUNCTION?
% WHAT HAPPENS WHEN THERE'S NOT ENOUGH POINTS IN THE RANGE?
%%---------------------------------------------------------------
% Part 5
% Use arrays to create plots of the given functions with specific step
% sizes.
%-----------------------------------------------------------------
disp('Part 5'); %output to command window
% Part 5 is alomst identical to part 4 except you cannot use the linspace
% command.
% Create an array of 'x' values for the given range and step size.
% Then use that to calculate an array of corresponding 'y' values and plot
% x vs. y.
% linspace WILL NOT WORK FOR THIS.
% Notice one function starts at x=0 but the other function starts at x=1.
% Create the arrays and function values here.
x3start =0;
stepsize3=0.25;
x3end =20;
x3=
y3=
x4start =
x4=
%Create the plot (COMPLETE THESE COMMANDS)
fig = figure(2); clf; grid on; hold on;
xlabel('x'); ylabel('y'); title('Part 5- Step Array Calcs');
p = plot(
set(p, 'Color','red', 'LineWidth',2);
p = plot(
set(p, 'Color','blue', 'LineWidth',3);
legend('Function 1', 'Function 2', 'Location', 'northwest');
% HOW MANY 'STEPS' WERE TAKEN FOR EACH FUNCTION?
% HOW MANY POINTS (x,y data pairs) WERE CREATED FOR EACH FUNCTION?
% WHAT WAS THE STEP SIZE FOR EACH FUNCTION?
% WHAT HAPPENS WHEN THE STEP SIZE IS TOO LARGE?
% CAN YOU ADJUST PART 4 & PART 5 TO GET THE EXACT SAME STEP SIZE AND NUMBER
% OF POINTS (using the 2 diff

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases 11th British National Conference On Databases Bncod 11 Keele Uk July 7 9 1993 Proceedings Lncs 696

Authors: Michael F. Worboys ,Anna F. Grundy

1993rd Edition

3540569219, 978-3540569213

More Books

Students also viewed these Databases questions

Question

Stages of a Relationship?

Answered: 1 week ago