Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please add comments to this Matlab code: a) n=1; m=1; stepSize=0.01; for a= -10:stepSize:10 for b= -10:stepSize:10 y(m, n)=funPlot(a,b); x1(m,n)=a; x2(m,n)=b; n=n+1; end m=m+1; n=1;

Please add comments to this Matlab code:

a)

n=1;

m=1;

stepSize=0.01;

for a= -10:stepSize:10

for b= -10:stepSize:10

y(m, n)=funPlot(a,b);

x1(m,n)=a;

x2(m,n)=b;

n=n+1;

end

m=m+1;

n=1;

end

figure

mesh(x1, x2, y)

xlabel('a')

ylabel('b')

zlabel('y')

function y = funPlot(a,b)

if ((abs(a)>abs(b)) || (abs(a)

y=a*a+b*b;

elseif abs(a)==abs(b)

y=0;

end

end

b)

clc

clear all

close all

n=1;

for k=-10:0.01:10

x(n) = k;

if((x(n)<=-1) || ((x(n)>=0) && (x(n)<1)) || (x(n)>=5))

y(n)=0;

elseif ((x(n)>-1) && (x(n)<0))

y(n)=-2*x(n);

elseif (x(n)>=1) && (x(n)<2)

y(n)=-2+2*x(n);

elseif (x(n)>=2) && (x(n)<4)

y(n)=2;

else y(n)=-6+2*x(n);

end

n=n+1;

end

figure

plot(x,y)

axis([-10 10 -0.1 6])

grid on

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

Database Systems Design Implementation And Management

Authors: Carlos Coronel, Steven Morris

14th Edition

978-0357673034

More Books

Students also viewed these Databases questions

Question

3. Review the evidence. Do you believe the testimony presented?

Answered: 1 week ago

Question

1. What are the marketing implications of this situation?

Answered: 1 week ago