MATLAB Will Execute The Above Statement and Return The Following Result
MATLAB Will Execute The Above Statement and Return The Following Result
MATLAB will execute the above statement and return the following
result
ans = 89
quadratic(2,4,-4)
MATLAB will execute the above statement and return the following
result
ans = 0.7321
Format
Purpose
A(:,j)
A(i,:)
A(:,:)
A(j:k)
is A(j), A(j+1),...,A(k).
A(:,j:k)
is A(:,j), A(:,j+1),...,A(:,k).
A(:,:,k)
A(i,j,k,:
)
A(:)
Everyforcommandmusthaveamatchingendstatementtoindicatewhichcommandsshouldbeexecutedseveraltimes.
Youcanhavenestedforloops.Forexample:
form=1:3
forn=1:3
x(m,n)=m+n*i;
end
end
definesxtobethematrix:
x=
1.0000+1.0000i1.0000+2.0000i1.0000+3.0000i
2.0000+1.0000i2.0000+2.0000i2.0000+3.0000i
3.0000+1.0000i3.0000+2.0000i3.0000+3.0000i