Generating Professional Two-Dimensional Graphics in MATLAB

แชร์
ฝัง

ความคิดเห็น • 41

  • @samblake9953
    @samblake9953 หลายเดือนก่อน +1

    This is a really good video that sure beats sifting thru math works documentation for hours! (Not that the documentation is bad, I actually quite like it)

  • @AceYourGRE
    @AceYourGRE 2 ปีที่แล้ว +2

    This video is fantastic, thank you very much for your help and your way of making things intuitive and simple!

  • @MrDp9000
    @MrDp9000 4 หลายเดือนก่อน +1

    Dear Prof.,
    I am following your lectures and I'm learning a lot of new things.
    Just a quick question. Why did we take the FFT and then inverse FFT. I want to understand what did FFT did to the 2d plot and what did inverse FFT did.
    Thanks

    • @empossible1577
      @empossible1577  4 หลายเดือนก่อน +1

      When you calculate the FFT, you are calculating the amplitude of all the frequencies making up the original signal (or image). If you then calculate the inverse FFT, you are back to your original signal (or image). In this algorithm, some of the frequencies are set to zero after the first FFT. This leads to filtered signal (or image) after the inverse FFT. I do this to create low frequency noise.
      If you want to see more that all the Fourier transforms and this noise generating algorithm, checkout Topic 9 here:
      empossible.net/academics/emp4301_5301/

    • @MrDp9000
      @MrDp9000 4 หลายเดือนก่อน +1

      @@empossible1577 thank you prof. for the explanation

  • @erayceyhan2453
    @erayceyhan2453 3 หลายเดือนก่อน +1

    Thanks for the informative tutorial. I want to ask something that I couldn't reason. When you construct number of pixels Nx and Ny you said you wanna make them as square as possible and writing the code Ny = round(...). Instead of doing that why didn't you simply write Nx = Ny, did I miss something over here?. Thanks.

    • @empossible1577
      @empossible1577  3 หลายเดือนก่อน

      Great question!
      First, if you are just trying to draw pictures, the techniques I am teaching about ‘Nx’ and Ny are sort of silly. These skills are needed when you are building geometries into arrays for some sort of numerical analysis or simulation. For me, it is electromagnetic simulations and I am building shapes into arrays that I want to simulate electromagnetic waves interacting with. I may have to build a rectangle on the grid that is something like 1.0 cm x 1.32 cm. What grid resolution ‘dx’ and ‘dy’ would I choose for this? To represent both dimensions exactly, I would need dx=dy=0.01 cm to keep the pixels in my array perfectly square. However, that would require a very large array and I could easily run out memory doing it this way. Instead, I will make ‘dx’ and ‘dy’ slightly different numbers so that I can represent 1.0 cm and 1.32 cm with an exact integer number of cells while keeping the pixels as square as possible. For example, I would make dx=0.1 and dy=0.0943. Now I can represent 1.0 cm with exactly 10 cells, 1.32 cm with exactly 14 cells, and the grid has close to square shaped pixels. I may have overstated the need the keep the pixels perfectly square. I have successfully run simulations where the pixels were more than 10:1 stretched. It is just good practice to stay as close to square as possible without worrying about being perfect.
      Hope this makes sense!

    • @erayceyhan2453
      @erayceyhan2453 2 หลายเดือนก่อน +1

      @@empossible1577 Thank you so much for your explanation. In short what I understand is about finding a balance between accuracy and practicality when creating grids for simulations, so you don't use more memory than necessary while still representing the shapes as accurately as possible :)

    • @empossible1577
      @empossible1577  2 หลายเดือนก่อน

      @@erayceyhan2453 I think 99% of computation is trying to fight the accuracy vs efficiency tradeoff. Have fun with it!

  • @jiminaah777
    @jiminaah777 5 หลายเดือนก่อน +1

    can you please make the video on how to draw or convert these into 3d that somewhat shows a real picture kind of thing ..

    • @empossible1577
      @empossible1577  5 หลายเดือนก่อน +1

      Are you talking about like the 3D images here:
      th-cam.com/video/5bCSq21ktQk/w-d-xo.htmlsi=s1L8BR-Nvy83WaN7

  • @williampowell7518
    @williampowell7518 2 ปีที่แล้ว +1

    What Color format does the imagesc function use. How would one convert from RGB for example to the format that is used?

    • @empossible1577
      @empossible1577  2 ปีที่แล้ว

      The RGB formatting you are talking about is probably the jet colormap in MATLAB. It was the default colormap until something like five years ago. The new default colormap is called parula. You can change the colormap using one of the following commands...
      colormap('jet');
      colormap('parula');

    • @williampowell7518
      @williampowell7518 2 ปีที่แล้ว

      @@empossible1577 Ok thanks for your response. Here is what I am trying to do. I have an array of data but it is in the RBG565 format(binary). I want to load the file into MATLAB so that it is displayed however I dont know the format that imagesc accepts.
      from the function description I see where it has just an array of a single value (C), imagesc(C).
      example C=[5 4 5; 3 5 7]. how does those values in the matrix represent color.
      I want to know so that I can convert my values to that format and have MATLAB display the data

    • @empossible1577
      @empossible1577  2 ปีที่แล้ว +1

      @@williampowell7518 Hmmm...I have never done this, but I did find the following information...
      stackoverflow.com/questions/3578265/how-can-i-convert-between-rgb565-and-rgb24-image-formats-in-matlab

  • @FatimaAlsayigh
    @FatimaAlsayigh 3 หลายเดือนก่อน +1

    If i follow these steps can I get an image? If I use data from different node RF? to find an object?

    • @empossible1577
      @empossible1577  3 หลายเดือนก่อน

      The process would be to assemble your data in an array and use a command like imagesc() or pcolor() to image it. I am not sure what "different node RF" is. There is an image processing toolbox available that may make things like object recognition easier. I don't use the toolbox. I am only aware that it exists so I am unsure of the functionality. All that said, you can definitely use MATLAB somehow to find objects in images.

    • @FatimaAlsayigh
      @FatimaAlsayigh 3 หลายเดือนก่อน +1

      @@empossible1577 can you help me pls ihave many question?

    • @empossible1577
      @empossible1577  3 หลายเดือนก่อน

      @@FatimaAlsayigh I can certainly answer quicker questions, but if you need to do any kid of work, I may not be able to help until later September.

    • @FatimaAlsayigh
      @FatimaAlsayigh 3 หลายเดือนก่อน

      @@empossible1577 iwant to know how to use tikhnove or LPP or FBp. With matrix to get image and heat map

  • @Rainstorm121
    @Rainstorm121 3 ปีที่แล้ว +1

    Thanks Sir. I have produced a subplots of maps (with lats and lon) in two columns on an axis. But there is a big white space between the two columns of subplots. Is there a way to delete this white space in matlab?

    • @empossible1577
      @empossible1577  3 ปีที่แล้ว +1

      Yes, there are several ways. The easiest is the play with the size of your figure window. If that does not work, you can create four subplots, plot in the first two for your first plot and the second two for your second plat. There are also ways to manually define the size and position of each subplot.

  • @АлимМухтаровичБеккиев
    @АлимМухтаровичБеккиев 3 ปีที่แล้ว +1

    You are the best!
    But i have a question... How do I get the grid on the last graph? Grid from selected ticks on X and Y axis

    • @empossible1577
      @empossible1577  3 ปีที่แล้ว

      Take a look at Topic 2 from the course website. That is where I teach all the graphics methods.
      empossible.net/academics/emp4301_5301/

  • @adrijade9793
    @adrijade9793 ปีที่แล้ว +1

    Sir, how can we scale the axis of a contour plot?

  • @matthewbarnes1356
    @matthewbarnes1356 3 ปีที่แล้ว +1

    Hey there, im working on a pcolor plot, and was wondering if you could explain how to make the first row and column serve as the x and y axis. Thanks so much

    • @empossible1577
      @empossible1577  3 ปีที่แล้ว

      Are you trying to draw the axes or just have the first row and column be x=0 and y=0? The general format for a call to pcolor is
      pcolor(x,y,A)
      Here, x and y are arrays containing the position of the points long x and y axes. Simply make it so that both x and y start at zero.
      If you are trying to draw the axes, you will need to call pcolor and then call another function like line() to draw the axes.

    • @matthewbarnes1356
      @matthewbarnes1356 3 ปีที่แล้ว

      @@empossible1577 In the sheet containing all of the data the first column states the time when measurements were taken, the first row states all the wavelengths times were taken. The data is the remainder of the chart. I have been told to use that first column as the Y-axis, and the first row as the X-axis.

    • @empossible1577
      @empossible1577  3 ปีที่แล้ว

      @@matthewbarnes1356 Sounds like you will need to extract the first column into the array y and the first row into the array x. Then extract the data starting at row 2 and column 2 into the array A. Then you can plot it as pcolor(x,y,A).

  • @nehalvarma8576
    @nehalvarma8576 2 ปีที่แล้ว +1

    Sir, how to create these type of plots from a given dataset(in excel)?? (Sorry, I am new to MATLAB)

    • @empossible1577
      @empossible1577  2 ปีที่แล้ว

      If the data is in Excel, you can import an Excel file into MATLAB using the xlsread() function built into MATLAB. From there, you would plot as described in the video.

    • @nailazaman3558
      @nailazaman3558 ปีที่แล้ว

      @@empossible1577 I am new to MATLAB and trying to plot data from EXcel. After importing data from excel, can you mention which step should I start from? Do I need to define the "function size", and "generate random function"? or should I start from "Function Axes"?

    • @empossible1577
      @empossible1577  ปีที่แล้ว

      @@nailazaman3558 I do not know anything about the data you are plotting. Since you already have data, I do not see any need for random function data. Instead of defining the function size, determine the function size from the size of the array read from the Excel file. Never define anything that can be determined or you are setting yourself up for problems if something becomes inconsistent. The next step is probably defining the function axes, and then finally the plotting. Again, it is very hard to say your steps without knowing anything about what you are plotting.

  • @alaaal-jobory6994
    @alaaal-jobory6994 3 ปีที่แล้ว +1

    Hello, it is a very good Lecture, my problem how do the same thing with external file have 2 column x and y?

    • @empossible1577
      @empossible1577  3 ปีที่แล้ว

      What sort of external file? Are you asking how to load the file or format the graphics?

    • @alaaal-jobory6994
      @alaaal-jobory6994 3 ปีที่แล้ว

      @@empossible1577 -0.37 1.974163e+01
      -0.34 -1.743774e+01
      -0.45 -7.923848e+01
      -0.50 1.353119e+01
      -0.85 -7.012825e+01
      -0.31 -4.750114e+01
      -0.43 -7.220450e+01
      -0.49 -7.475068e+01
      -0.48 -7.115190e+01
      -0.41 -2.632539e+01
      -0.24 -1.106730e+01
      -0.58 -8.653299e+01
      -0.74 -3.856418e+01
      -0.37 -3.319859e+01
      -0.58 -8.538624e+01
      -0.80 -7.355718e+01
      -0.90 -5.947275e+01
      -0.81 -4.601984e+01
      -0.83 -5.830147e+01
      -0.78 -4.617531e+01
      -0.57 -6.750198e+01
      -0.65 -7.030725e+01
      -0.53 -6.258158e+01
      -0.73 -6.681263e+01
      -0.73 -7.141510e+01
      -0.86 -8.148636e+01
      -0.68 -8.640184e+01
      -0.51 -5.714105e+01
      -0.43 -1.768872e+01
      -0.90 -4.522189e+01
      -0.87 -8.400792e+01
      -1.16 -4.656557e+01
      -1.08 -1.504589e+01
      -1.23 -2.808902e+01
      -0.79 -8.309950e+01
      -0.89 -4.959167e+01
      -0.85 -5.300033e+01
      -0.93 -6.062692e+01
      -0.77 -6.112564e+01
      -0.67 -9.272722e-01
      -0.44 -5.947116e+01
      -0.56 -5.867817e+01
      -0.63 -7.936987e+01
      -0.55 -7.941028e+01
      -0.28 -1.145137e+01
      -0.66 -9.418415e+01
      -0.67 5.122354e+00
      -0.33 -4.983205e+01
      -0.33 -3.607897e+01
      -0.35 -3.230937e+01
      -0.46 -7.490720e+01
      -0.41 -6.666823e+01
      -0.48 -6.547953e+01
      -0.57 -8.182616e+01
      -0.40 -4.746677e+01
      -0.22 -1.671533e+01
      -0.24 -1.533376e+01
      -0.25 4.541601e+00
      -0.49 -3.846674e+01
      -0.32 3.730436e+00
      i am try to plot this file like your lecture!!!

    • @empossible1577
      @empossible1577  3 ปีที่แล้ว

      @@alaaal-jobory6994 You need to study 1D graphics for this, not 2D graphics. See MATLAB Session 2.2 under Topic 2 here:
      empossible.net/academics/emp4301_5301/

    • @alaaal-jobory6994
      @alaaal-jobory6994 3 ปีที่แล้ว

      @@empossible1577 I am looking for heat map graph for this data? anyway i am going to watch this lecture, thank you so much for the help