Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB PROGRAMMING just 3.12 Create an array of 100 input samples in the range 1

ID: 3809348 • Letter: M

Question

MATLAB PROGRAMMING

just 3.12

Create an array of 100 input samples in the range 1 to 100 using the lenspiece function, and plot the equation y (x) = 20 log_10 (2x) on a semi logy plot. Draw a solid blue line of width 2, and label each point with a red circle. Now create an array of 100 input samples in the range 1 to 100 using the log space function, and plot Equation (3.5) on a semi logy plot. Draw a solid red line of width 2, and label each point with a black star. How does the spacing of the points on the plot compare when using 1 in space and log space? Error Bars When plots are made from real measurements recorded in the laboratory, the data that we plot is often the average of many separate measurements. This kind of data has two important pieces of information: the average value of

Explanation / Answer

x = linspace(1,100,100);
y = 20*log10(x);

fig = semilogx(x,y,'-bo','LineWidth',2)

x = logspace(1,100,100);
y = 20*log10(x);

fig = semilogx(x,y,'-r*','LineWidth',2,'MarkerEdgeColor','black')

In linspace 0-100 is divided into 100 linearly spaced samples

but in logspace, 0-100 generates 100 points between decades 10^0 and 10^100.