フィルターのクリア

Hi I would like to plot 2D beam plot from the Ultrasound data. I want to make it like the reference image I am uploading my code along with data I would appreaciate kind help.

5 ビュー (過去 30 日間)
% Given data
x_values = [-5 -4 -3 -2 -1 0 1 2 3 4 5];
y_values = [-5 -4 -3 -2 -1 0 1 2 3 4 5];
intensity_x = [0.354894 0.264706 0.518834 0.261813 0.407010 1.034944 0.321868 0.235763 1.162762 0.132057 1.335990];
intensity_y = [0.308505 0.350254 0.517485 1.779078 0.403396 1.083260 0.390343 0.520409 0.527385 0.480424 0.474484];
% Reshape intensity data into matrices for imagesc plot
intensity_x_matrix = reshape(intensity_x, [numel(y_values), numel(x_values)]);
intensity_y_matrix = reshape(intensity_y, [numel(y_values), numel(x_values)]);
% Plotting intensity values
figure;
imagesc(x_values, y_values, intensity_x_matrix + intensity_y_matrix);
xlabel('X Direction (mm)');
ylabel('Y Direction (mm)');
title('Pseudocolor Plot - Intensity X and Y');
colorbar;
colormap('jet');
axis square;

採用された回答

Angelo Yeo
Angelo Yeo 2024 年 3 月 6 日
The script below to reshape doesn't make sense because the row x col of the target matrix must match the original matrix.
intensity_x_matrix = reshape(intensity_x, [numel(y_values), numel(x_values)]);
intensity_y_matrix = reshape(intensity_y, [numel(y_values), numel(x_values)]);
Maybe what you wanted was to repmat?
% Given data
x_values = [-5 -4 -3 -2 -1 0 1 2 3 4 5];
y_values = [-5 -4 -3 -2 -1 0 1 2 3 4 5];
intensity_x = [0.354894 0.264706 0.518834 0.261813 0.407010 1.034944 0.321868 0.235763 1.162762 0.132057 1.335990];
intensity_y = [0.308505 0.350254 0.517485 1.779078 0.403396 1.083260 0.390343 0.520409 0.527385 0.480424 0.474484];
% Reshape intensity data into matrices for imagesc plot
intensity_x_matrix = repmat(intensity_x, numel(y_values), 1);
intensity_y_matrix = repmat(intensity_y', 1, numel(x_values));
% Plotting intensity values
figure;
imagesc(x_values, y_values, intensity_x_matrix + intensity_y_matrix);
xlabel('X Direction (mm)');
ylabel('Y Direction (mm)');
title('Pseudocolor Plot - Intensity X and Y');
colorbar;
colormap('jet');
axis square;
  1 件のコメント
Honey
Honey 2024 年 3 月 6 日
Yes I think repmat would be more suitable for this.Thank you so much for this effort.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by