A collection of simple functions in MATLAB?

Updated on technology 2024-03-06
6 answers
  1. Anonymous users2024-02-06

    Leave an email address and send it to you.

  2. Anonymous users2024-02-05

    Too much. Look at it with help.

    And it should be looked at in a classified way.

  3. Anonymous users2024-02-04

    The function given by the subject is a piecewise function, which can be implemented with ** in MATLAB

    1. First of all, create a custom segmentation function, PieceWise fun(x), and save it as a PieceWise file. Piecewise fun(x) function, for

    function y=piecewise_fun(x)

    n=length(x);

    for i=1:n

    if x(i)>=0 & x(i)<=1

    y(i)=x(i);

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

    y(i)=2*x(i)-1;

    elseif x(i)>2

    y(i)=x(i).^2-1;

    else

    y(i)=0;

    end

    end

    end

    2. Then in the command window of MATLAB, execute the next command

    >>x=-10::10;% for example

    >>y=piecewise_fun(x)

    >>plot(x,y),grid on

    >>xlabel('x'),ylabel('y(x)')

  4. Anonymous users2024-02-03

    1. Beginner - learn the relevant operations of mathematics (matrix) and the application of various common functions.

    2. Re-introduction - learn the programming methods and skills of MATLAB object-oriented language.

    3. A glimpse of the door - because MATLAB is just a tool software, the so-called fool's language, so it is just an auxiliary thing, not to learn MATLAB for the sake of learning MATLAB, the most important thing for us is to let him serve us, should be based on their specific application field at this stage or in the future, MATLAB provides a lot of toolboxes (signal processing, control, voice, etc.), position yourself, and get twice the result with half the effort.

    4. Explore by yourself - MATLAB is not like C language, it is very scattered, you should write down the functions used in your work and study, and move towards the master.

  5. Anonymous users2024-02-02

    Take a look at the basic grammar and improve it in practice, and when you have time, you can read the classic textbooks to be proficient. It would also be helpful to find more classic programs and look into them.

  6. Anonymous users2024-02-01

    1) Divide sub-areas.

    Method 1: Image I is a matrix, and dividing it into sub-regions is to take the corresponding rows and columns of the matrix according to a certain law.

    For example, in an i 100*100 matrix, the 10*10 sub-regions are:

    Then the first block is: (1:10,1:10) The sub-region number is (1,1).

    The second block is: (11:20,10) The sub-area is numbered (2,1).

    And so on: this can be achieved by looping:

    for i=1:10;

    for j=1:10;

    eval(['i' num2str(i) num2str(j) 'i(1+10*(i-1):10+10*(i-1),1+10*(j-1):10+10*(j-1))'

    endend

    Each sub-region is i11, i12, i13....i1010

    Example: <>

    Method 2: Use the Crop command to crop out the corresponding area

    i2=imcrop(i,rect)

    The rect is the boundary of the corresponding area.

    For example: i11=imcrop(i,[1,1,10,10]); That is, the coordinates of the upper-left and lower-right corners of the subregion.

    An example is as follows:

    for i=1:10;

    for j=1:10;

    eval(['i' num2str(i) num2str(j) 'imcrop(i,[1+10*(i-1),1+10*(i-1),10+10*(j-1),10+10*(j-1)])

    endend

    <>2) How to find and draw a histogram:

    x,n]=hist(i(:)1:255);

    x returns the midpoint between cells of the abscissa array --- frequency statistics.

    n returns the frequency of each interval --- ordinate array.

    plot(n,x)

    In addition, it can also be used directly:

    p=imhist(i);

    plot(p);

    Probability density: plot(p n);

    n is the total number of points in the region, for example, 10*10.

    3) Use the division area with the grayscale histogram:

    for i=1:10;

    for j=1:10;

    p(10*(i-1)+j,:)imhist(i(1+10*(i-1):10+10*(i-1),1+10*(j-1):10+10*(j-1)))

    endend

    Then the histogram statistics for each subregion are in each row of the p-matrix, for a total of 100 rows.

Related questions
8 answers2024-03-06

Arbitrary x10 x1f(x2) so subtract the function.

Question 4 Arbitrary x10 x2-x1>0 So f(x1)-f(x2)>0 >>>More

12 answers2024-03-06

You don't need to learn MATLAB, you can go to university and learn it again. >>>More

7 answers2024-03-06

Constant function y=k

1.Define the domain r >>>More

8 answers2024-03-06

Suppose a certain consumption is copied.

The utility function of the consumer is u=q, where q is the consumption of the consumer and m is the income, and the demand function of the consumer is found. First of all, recall the general utility function: the general utility function is u=f(x1,x2), which is about two goods, and the solution method is based on consumer equilibrium: >>>More

7 answers2024-03-06

The derivative of the tangent function is (secx) 2;

Derivatives are good local properties of functions. The derivative of a function at a point describes the rate of change of the function around that point. If both the independent variables and the values of the function are real, the derivative of the function at a point is the tangent slope of the curve represented by the function at that point. >>>More