accessing meshgrid point in a plot, calculate some value at each point and then plot those values in the entire plot using pcolor

4 views (last 30 days)
hey friends I draw a figure (to be precise, a one line diagram of a power system) by developing matlab code. And I have certain values of a particular property (say Vi) in certain points of that figure ( to be precise i=no of bus. I have 30 buses.) I use meshgrid to create coordinate at all points of the plot. Now I need to calculate a value (say Vp) for all the points in the plot using the abovementioned value Vi at the given points, I am using the following formula
Vp=∑ (Vi/dpi2 )/∑( 1/dpi2 )
Where d = distance between point p and i
Here is my code...
for i=1:30
busc (i,1)=xyb((2*i-1),1)+(xyb(2*i,1)-xyb((2*i-1),1))/2; % x coordinate for bus center ie gives me the coordinates of the point where V is given
busc (i,2)=xyb(2*i,2); % y coordinate
end
for i=1:180 % to access meshgrid points
for j=1:180 % to access meshgrid points
for k=1:30 % to access all the buses
dist(k)=1/(((busc(k, 1) - i)^2+ (busc(k, 2) - j)^2)^0.5)^2; %for calculating the fv value
vvolt(k)=r.bus(k,8)./(((busc(k, 1) - i)^2+ (busc(k, 2) - j)^2)^0.5)^2;%for calculating the fv value
end
rr=sum(vvolt')'; %for calculating the fv value
uu=sum(dist')'; %for calculating the fv value
result=rr./uu;
fvolt(i,j)=result;
end
end
g= pcolor(X,Y,fvolt);
set(g,'LineStyle','none')
myColorMap = flipud(jet);
colormap(myColorMap);
colorbar;
%set(gca,'YDir','reverse');
axis off;
MY QUESTION: I am getting points but not matching with my requirement. However if I rotate 90 degree anticlockwise, it gives me the result. Can someone please tell me how to rotate my figure by 90 degree. I just want to rotate my figure for the contouring ie for pcolor result. Not for my one line diagram.
There may be some mistake in my formula. Can someone please help me with that.

Answers (0)

Community Treasure Hunt

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

Start Hunting!