Monday, August 14, 2017

1ra clase Métodos numéricos

>> 6+4

ans =

    10

>> V=[1 3 5]

V =

     1     3     5

>> W=[8;2.5;-1]

W =

    8.0000
    2.5000
   -1.0000

>> format long
>> w
??? Undefined function or variable 'w'.

>> W

W =

   8.000000000000000
   2.500000000000000
  -1.000000000000000

>> format short
>> pi

ans =

    3.1416

>> A=[2 3 -1; 4 5 0.5]

A =

    2.0000    3.0000   -1.0000
    4.0000    5.0000    0.5000

>> A1=[2 8]

A1 =

     2     8

>> 1b=7
??? 1b=7
     |
Error: Unexpected MATLAB expression.

>> pi=6

pi =

     6

>> pi

pi =

     6

>> cos(2)

ans =

   -0.4161

>> cos=5

cos =

     5

>> cos(2)
??? Index exceeds matrix dimensions.

>> clear pi
>> pi

ans =

    3.1416

>> clear all
>> clear
>> x=linspace(0,2*pi,100);
>> y=sin(x);
>> plot(x,y)
>> x=linspace(0,2*pi,10);
>> plot(x,sin(x));
>> x=-2:0.1:3;
>> y=x^2;
??? Error using ==> mpower
Matrix must be square.

>> y=x.^2;
>> plot(x,y);
>> x=0:0.1:1;
>> y=1./x

y =

  Columns 1 through 8

       Inf   10.0000    5.0000    3.3333    2.5000    2.0000    1.6667    1.4286

  Columns 9 through 11

    1.2500    1.1111    1.0000

>> plot(x,y)
>> x=0:0.1:2;
>> plot(x,1./x,x,sin(x));
>>

No comments:

Post a Comment