How can i make a colored 2d grid map, using a equation?

조회 수: 7 (최근 30일)
stonedbored
stonedbored 2021년 3월 26일
답변: KSSV 2021년 3월 26일
My doubt is that, i want to make a colored 2d grid map using an equation. For ex, lets say i have a big intensity of a phenomenon in the center or elsewhere and it's decreasing with the distance from the source. Like sound propagation.
Maybe there is a maptool that can i modify the parameters in how the color changes from red colors range (high levels) to blue colors range (low levels) following an equation.
Hope someone can be of help.
  댓글 수: 2
KSSV
KSSV 2021년 3월 26일
Show us the equation...
stonedbored
stonedbored 2021년 3월 26일
I have the values of q,k,a. I want to see how the pressure values changes in relation to the distance from the source on a colored grid map. So far, i know how to do a vector from 1 to 100 meters and see it on a graph, but my idea is to move the source in a 100x100 meters image for example, and see how the the intensity of the pressure decreases or changes. I guess its something related to the coordinates of the map.
Any idea?

댓글을 달려면 로그인하십시오.

답변 (2개)

Bjorn Gustavsson
Bjorn Gustavsson 2021년 3월 26일
This is exactly what matlab is for, so you're thinking about the right tool. For a quick take-off I recommend you look through the matlab-onramp material, there this type of topics will be introduced together with a lot of other important stuff. Then you can do this, but if you run into problems just ask for the details of where you get stuck.
Welcome to matlab!

KSSV
KSSV 2021년 3월 26일
You need to proceed something like this:
% mesh
x = linspace(-1,1) ;
y = linspace(-1,1) ;
[X,Y] = meshgrid(x,y) ;
p = [0 0] ; % charge is at this point
%
R = sqrt((p(1)-X).^2+(p(2)-Y).^2) ;
% constants
Ka = 1 ;
Q = 3.5 ;
a = 2 ;
% Equation
P = Ka*(R/Q^(1/3)).^a ;
surf(X,Y,P)

카테고리

Help CenterFile Exchange에서 Blue에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by