0% found this document useful (0 votes)
68 views1 page

Matlab PDF

The document shows MATLAB code that generates two vectors, C and A, where C contains values from 2 to 5 incremented by 0.5 and A contains the cubed values of C plus 3.5 times the squared values of C minus 40. It then generates a zero vector A0 of the same length as C and plots C against A and C against A0. It then sets a new value for C and calculates the corresponding value in A.

Uploaded by

solehah misni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views1 page

Matlab PDF

The document shows MATLAB code that generates two vectors, C and A, where C contains values from 2 to 5 incremented by 0.5 and A contains the cubed values of C plus 3.5 times the squared values of C minus 40. It then generates a zero vector A0 of the same length as C and plots C against A and C against A0. It then sets a new value for C and calculates the corresponding value in A.

Uploaded by

solehah misni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MATLAB Command Window Page 1

>> C=(2:0.5:5)

C =

Columns 1 through 5

2.0000 2.5000 3.0000 3.5000 4.0000

Columns 6 through 7

4.5000 5.0000

>> A=(C.^3)+(3.5.*(C.^2))-40

A =

Columns 1 through 5

-18.0000 -2.5000 18.5000 45.7500 80.0000

Columns 6 through 7

122.0000 172.5000

>> A0=zeros(1,length(C))

A0 =

0 0 0 0 0 0 0

>> plot(C,A,C,A0)
>> C=2.57

C =

2.5700

>> A=(C.^3)+(3.5.*(C.^2))-40

A =

0.0917

>>

You might also like