Quantcast
Channel: MATLAB Central Newsreader - graph plotting help required
Viewing all articles
Browse latest Browse all 8

Re: graph plotting help required

$
0
0
On 12/16/2014 4:35 PM, Hamza wrote:
> i wanna plot buck_boost converter's conversion ratio in matlab(.m) file.
> i wrote this:
>
> D=0:0.2:1;
> x= -(D./(1-D));
> plot(x,D)
>
> now comes the questions:
> 1) i want x-axis on top with limits from 0 to 1 with step size 0.2
> (changing from left to right on top). actually i want 'D' on x-axis .
> how can i do it ?
>
> 2) i want y-axis on left , starting from 0 and decreasing to -5 (0 -1 -2
> -3 -4 -5 ) from top to bottom , how can i reverse y-axis ?
...

Pretty simply --

plot(D,x)
ax=gca;
set(ax,'xaxislocation','top','xtick',[0:0.2:1])
ylim([-5 0])
set(ax,'ydir','reverse','ytick',[-5:0])

See

doc axes

and the links therein to the graphics objects properties for axes.

--

Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images