2/19/2023 0 Comments Matlab log plot![]() From the plot it looks like the sampling rate of the data was probably 48kHz, the maximum rate of the ShureSM57. You could scale first parameter of semilogx w/pi by the sampling rate divided by 4. 'type', 'scatter' ) data = layout = struct (. freqz plots the frequency response assumption that the sampling rate of the data was 1Hz (1 sample/unit time). Read about the 'loglog' function in the MATLAB documentation. TextElements(i).String=strcat('1E',TextElements(i).Trace1 = struct (. This is an example of how to create a log-log plot in MATLAB. The next step consists in selecting all the elements of Type Text contained in tl : TextElements=findobj(tl,'Type','Text') įinally, The last step will be to loop over these and replace the numbers N with 1EN : for i=1:length(TextElements) Specify the marker fill color as the RGB triplet 0 0.447 0.741, which corresponds to a dark shade of blue. Specify the line style as 's' to display square markers without connecting lines. Now if you go see the description of tl, you'll see that it's a Data object, containing Text and Line elements. Create a set of x- and y-coordinates and display them in a log-log plot. Now instead of calling clabel(C,h1), we need to use another syntax of clabel that will allow us to loop trough the texts (The downgrade is that they'll be less pretty) : tl=clabel(C) ![]() Now call contourf with the vector of contour line values : =contourf(X,Y,log10(Z),1:nextpow10Z) and so on so you just need to find the first power of 10 bigger than the maximum of your data : nextpow10Z=ceil(log10(max(Z(:)))) You say you want them to be placed at 1,10. Create a log-log plot containing two lines, and. The first step consists in calculating the values of the contour lines. This MATLAB function plots x- and y-coordinates using a base-10 logarithmic scale on the x-axis and the y-axis. Summing up, I need to do one of the following:įind a way to set the logarithmic scale programmatically and let matlab worry about the isolines.īe able to manually change the label on the isolines without moving them (new_label = 10^old_label).Ī little 'Hack' that will work, although it will not be possible to keep the labels as nice as they are with a call to clabel(C,h1) : Ideally, I'd like to be able to something like this: = contourf(X, Y, Z, 'ZScale', 'Log') Īnd get the picture at the bottom with labels 10, 10^5, 10^10, etc. So, most of the labels won't be shown (they exceed data range) and the one that will, will be misplaced. But now my plotted data rang is (0, 45) (because I calculated the logarithm of it). 0:5:45 - and I'll get exactly what I have now.I can now set them to any vector you like: Here is how I do it (maybe there is another, better way, I don't know, I haven't found anything else): = contourf(X, Y, log(Z)) Īnd it looks well now - you can see how my data varies. Now, since my data in exponential, I have to use the logarithmic scale on the displayed values (the matrix Z) to show the data properly. I can set any countour lines labels I want, but they won't be visible since my data is exponential (And by the way, the labels that are visible in this plot, are the true ones, the ones I want to get on the next plot). To plot multiple sets of coordinates on the same set of axes, specify at least one of X or Y as a matrix. To plot a set of coordinates connected by line segments, specify X and Y as vectors of the same length. My question is: how can I get the right labels on the contours? I don't want a color bar as described here. semilogy (X,Y) plots x - and y -coordinates using a linear scale on the x -axis and a base-10 logarithmic scale on the y -axis. ![]() ![]() This is how I do it: = contourf(X, Y, log(Z)) ![]() I have some data that I want to display as contour plot with logarithmic scale of the values (the matrix Z) and labelled countours. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |