How to scatter plot when the values are i.e 1,1 and 1,10 grid

1 visualización (últimos 30 días)
trying to avoid repeating code
plot(sparams.frequency_GHz(1),delta(:,1))
plot(sparams.frequency_GHz(41),delta(:,1))
and for this when i try doing the same it does not work , possible to combine ??
plot(sparams.frequency_GHz(:,1),delta(:,2:end), plot_color,'HandleVisibility','off')
  2 comentarios
Kevin Holly
Kevin Holly el 22 de Ag. de 2022
Is sparams a table or struct array? How many rows and columns are there for frequency_GHz data? rows and columns for delta?
Ihaveaquest
Ihaveaquest el 22 de Ag. de 2022
struct array
both
Freq 41X16
delta 41x16

Iniciar sesión para comentar.

Respuesta aceptada

Kevin Holly
Kevin Holly el 22 de Ag. de 2022
Editada: Kevin Holly el 22 de Ag. de 2022
What do you want on your y and x axes?
sparams.frequency_GHz = 10*rand(41,16);
delta = rand(41,16);
This one separates the data based on the columns (16 groups)
scatter(sparams.frequency_GHz,delta,'filled')
xlabel('Frequency (GHz')
ylabel('Delta')
This one separates the data based on the rows (41 groups)
scatter(sparams.frequency_GHz',delta','filled')
xlabel('Frequency (GHz')
ylabel('Delta')
  3 comentarios
Kevin Holly
Kevin Holly el 22 de Ag. de 2022
Editada: Kevin Holly el 22 de Ag. de 2022
Are you saying there are 10 possible frequency values in the 41x16 matrix?
sparams.frequency_GHz = randi(10,41,16);
sparams.frequency_GHz
ans = 41×16
10 8 8 1 10 2 6 1 2 5 8 6 6 6 8 8 3 6 3 6 7 5 4 2 1 9 1 5 1 3 7 6 9 9 9 2 9 3 2 7 2 5 4 1 5 8 8 3 8 5 1 4 10 10 4 7 6 9 6 8 5 4 2 1 10 6 8 3 8 7 9 2 8 8 4 8 3 5 6 4 7 3 5 3 9 5 4 4 1 6 6 5 1 10 1 10 3 6 1 3 2 9 10 9 8 4 4 5 4 4 4 7 6 4 1 10 2 5 2 6 7 3 10 3 6 6 7 1 8 3 1 4 2 7 1 8 10 1 1 9 3 7 5 1 4 7 5 2 10 6 5 5 8 10 7 10 2 9 10 9
delta = rand(41,16);
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0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0
scatter(sparams.frequency_GHz(At_one_ten),delta(At_one_ten),'filled')
xlabel('Frequency (GHz')
ylabel('Delta')
Ihaveaquest
Ihaveaquest el 22 de Ag. de 2022
yes thatst the plot i need - Thank you

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Polar Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by