Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Has matlab a function to swap a vector? And generate a graph with 3 datasets.

Asked by ZhG on 11 Jun 2013

Hello,

Q1. I want to swap a vector like below, Is there a built-in function in Matlab? a = [ 1 2 3 4 5 6 ] a = swap(a) = [6 5 4 3 2 1 ]

Q2. I want to generate a graph for three data sets with different length. Each data set ranges from 0 to 1. E.g. ds1 = [0 0.1 0.25 .... 0.998 1] ds2 = 0:0.01:1 ds3 = [0 0.1 0.15 0.179 0.201 .... 1] And the graph looks like below (Actually, they are two histogram) https://biolab.csr.unibo.it/FvcOnGoing/FvcWebReports/477/DistributionGraph.png

Let ds2 to be the horizontal axis. And plot ds1 and ds2 along with vertical axis.

1 Comment

the cyclist on 11 Jun 2013

I suggest you split this into two questions, so that you can accept answers separately.

ZhG

Products

No products are associated with this question.

1 Answer

Answer by the cyclist on 11 Jun 2013
Accepted answer

Answer to Q1: Use the fliplr() function.

1 Comment

ZhG on 11 Jun 2013

Merci, cyclist.

the cyclist

Contact us