Showing posts with label MATLAB. Show all posts
Showing posts with label MATLAB. Show all posts

Monday, 11 August 2014

Design of Solar Wind hybrid grid connected power system Project


Both Solar & Wind power are used in remote areas for charging a battery and delivery of grid quality electricity through large capacity sine wave inverters. In areas where wind speeds are above 5.4 m/s, our 1 Kw wind turbine will deliver more than 5Kwh of energy everyday as against maximum 4 Kwh delivered by 1 Kw solar panel. Our 3.2 KW Whisper 500 wind turbine delivers 16 KWH of energy per day at 5.4 m/s annual wind speed average. When the wind speed is above 6.3 m/s average, our 1 Kw wind turbine delivers 8 Kwh of energy/day. Wind turbines are less expensive than solar panels of the same capacity. Therefore, in places where wind speeds are above 5 m/s it is advisable to use a combination of wind and solar power for optimum investment & maximum output. It is also to be noted that wind power and solar power complement each other. During monsoon months solar power generation is reduced to a large extent due to cloudy skies, during the same period, the wind speeds are much higher than rest of the year. During monsoon, wind turbines generate extra power to compensate for the loss of solar power.

Monday, 12 August 2013

Special Matrix plots! : Hibert, Magic, Pascal, Toeplitz, Vandermonde, Wilkinsons just enter command and view it





This just time pass to learn some of the special matrices of Algebra, code follows:
In linear algebra, a Hilbert matrix, introduced by Hilbert (1894), is a square matrix with entries being the unit fractions
For example, this is the 10 × 10 Hilbert matrix:

hilb(10); % Hibert Matrix
h = hilb(10);
plot(h)
title('Hilbert Matix')
axis off
hi = invhilb(10) % Inverse Hilbert matrix

hi =

   1.0e+12 *

    0.0000   -0.0000    0.0000   -0.0000    0.0000   -0.0000    0.0000   -0.0000    0.0000   -0.0000
   -0.0000    0.0000   -0.0000    0.0000   -0.0002    0.0005   -0.0008    0.0008   -0.0004    0.0001
    0.0000   -0.0000    0.0001   -0.0010    0.0043   -0.0112    0.0178   -0.0166    0.0085   -0.0018
   -0.0000    0.0000   -0.0010    0.0082   -0.0379    0.1010   -0.1616    0.1529   -0.0788    0.0171
    0.0000   -0.0002    0.0043   -0.0379    0.1768   -0.4772    0.7713   -0.7359    0.3821   -0.0832
   -0.0000    0.0005   -0.0112    0.1010   -0.4772    1.3015   -2.1210    2.0378   -1.0644    0.2330
    0.0000   -0.0008    0.0178   -0.1616    0.7713   -2.1210    3.4807   -3.3640    1.7661   -0.3884
   -0.0000    0.0008   -0.0166    0.1529   -0.7359    2.0378   -3.3640    3.2679   -1.7233    0.3804
    0.0000   -0.0004    0.0085   -0.0788    0.3821   -1.0644    1.7661   -1.7233    0.9123   -0.2021
   -0.0000    0.0001   -0.0018    0.0171   -0.0832    0.2330   -0.3884    0.3804   -0.2021    0.0449

plot(hi)
title('Inverse Hilbert Matix')
axis off

%In recreational mathematics, a magic square is an arrangement of numbers (usually integers) in %a square grid, where the numbers in each row, and in each column, and the numbers in the forward %and backward main diagonals, all add up to the same number. A magic square has the same number %of rows as it has columns, and in conventional math notation, "n" stands for the number of rows (and %columns) it has. Thus, a magic square always contains n2 numbers, and its size (the number of rows %[and columns] it has) is described as being "of order n". A magic square that contains the integers %from 1 to n2 is called a normal magic square.

m = magic(10)% Magic Matrix

m =

    92    99     1     8    15    67    74    51    58    40
    98    80     7    14    16    73    55    57    64    41
     4    81    88    20    22    54    56    63    70    47
    85    87    19    21     3    60    62    69    71    28
    86    93    25     2     9    61    68    75    52    34
    17    24    76    83    90    42    49    26    33    65
    23     5    82    89    91    48    30    32    39    66
    79     6    13    95    97    29    31    38    45    72
    10    12    94    96    78    35    37    44    46    53
    11    18   100    77    84    36    43    50    27    59

plot(m)
plot(m)
title('Magic Matrix')
axis off

In mathematics, particularly matrix theory and combinatory, the Pascal matrix is an infinite matrix containing the binomial coefficients as its elements. There are three ways to achieve this: as either an upper-triangular matrix, a lower-triangular matrix, or asymmetric matrix

pascal(10) % Pascal Matrix

ans =

           1           1           1           1           1           1           1           1           1           1
           1           2           3           4           5           6           7           8           9          10
           1           3           6          10          15          21          28          36          45          55
           1           4          10          20          35          56          84         120         165         220
           1           5          15          35          70         126         210         330         495         715
           1           6          21          56         126         252         462         792        1287        2002
           1           7          28          84         210         462         924        1716        3003        5005
           1           8          36         120         330         792        1716        3432        6435       11440
           1           9          45         165         495        1287        3003        6435       12870       24310
           1          10          55         220         715        2002        5005       11440       24310       48620

plot(ans)
title('Pascal Matrix')
axis off

%A matrix equation of the form
%
%is called a Toeplitz system if A is a Toeplitz matrix. If A is an   Toeplitz matrix, then the %system has only 2n−1 degrees of freedom, rather than n2. We might therefore expect that the %solution of a Toeplitz system would be easier, and indeed that is the case.

t = toeplitz(10) % Toeplitz Matrix

t =

    10


A Vandermonde matrix is a type of matrix that arises in the polynomial least squares fitting, Lagrange interpolating polynomials (Hoffman and Kunze p. 114), and the reconstruction of a statistical distribution from the distribution's moments

v = vander(10) % Vandermonde Matrix

v =

     1

In linear algebra, Wilkinson matrices are symmetric, tridiagonal, order-N matrices with pairs of nearly, but not exactly, equal eigenvalues. It is named after the British mathematician James H. Wilkinson

w = wilkinson(10) % Wilkinsons eigen value test matrix

w =

    4.5000    1.0000         0         0         0         0         0         0         0         0
    1.0000    3.5000    1.0000         0         0         0         0         0         0         0
         0    1.0000    2.5000    1.0000         0         0         0         0         0         0
         0         0    1.0000    1.5000    1.0000         0         0         0         0         0
         0         0         0    1.0000    0.5000    1.0000         0         0         0         0
         0         0         0         0    1.0000    0.5000    1.0000         0         0         0
         0         0         0         0         0    1.0000    1.5000    1.0000         0         0
         0         0         0         0         0         0    1.0000    2.5000    1.0000         0
         0         0         0         0         0         0         0    1.0000    3.5000    1.0000
         0         0         0         0         0         0         0         0    1.0000    4.5000

plot(w)
title('Wilkinson Matrix')

axis off

Saturday, 16 February 2013

Solving multivariable equations with MATLAB: An example


function fcn = mul_equ(u)

x = u(1);
y = u(2);

fcn(1)= x.^2 +2*y.^2-5*x+7*y-40;
fcn(2) = 3*x.^2-y.^2+4*x+2*y-28;

%result = fsolve(@mul_equ,guess)
%[result,fval,exit flag,output]= fsolve(@mul_equ,guess)

output is:


>> [result,fval,exit flag,output]= fsolve(@mul_equ,guess)
Optimization terminated: first-order optimality is less than options.TolFun.

result =

    2.6963    3.3655


fval =

  1.0e-008 *

    0.5849   -0.2216


exit =

     1


flag =

       iterations: 5
        funcCount: 18
        algorithm: 'trust-region dogleg'
    firstorderopt: 1.3017e-007
          message: 'Optimization terminated: first-order optimality is less than options.TolFun.'


output =

    0.3926   20.4620
   20.1779   -4.7310



Friday, 15 February 2013

MATLAB code for ball falling in circle 3D graphics


clf;
ellipsoid(1,4,9,1.1,2,3,20)
hold on
cylinder(10,20)
title('\fontsize{24}\bf\color{green}Drop the ball in the circle: MATLAB 3D GRAPHICS')
axis off