# case of two mappings

1 ビュー (過去 30 日間)
hang dong 2019 年 5 月 21 日
Commented: hang dong 2019 年 5 月 22 日
Hi everyone! I am having difficulty in the combination of the two mappings, I have tried many times but still have not found a way to build the program. hope everyone help me. thank you very much.

#### 1 件のコメント

Rik 2019 年 5 月 21 日
What do you mean exactly by mappings? Please provide a small example input and output to illustrate what you mean. And what have you tried so far?

サインイン to comment.

### 件の回答 (3)

Walter Roberson 2019 年 5 月 21 日
%mapping #1: x -> x^2
%mapping #2: x -> x/2 + 1
mapping1 = @(x) x.^2;
mapping2 = @(x) x/2 + 1;
map1_2 = @(x) mapping2(mapping1(x));
fplot(map1_2, [-5 5])

#### 0 件のコメント

サインイン to comment.

hang dong 2019 年 5 月 22 日
mapping1: permutation [0 1 3 2]
mapping2: permutation [0 3 2 1]
The combination of these two mappings will be a permutation I know how to calculate it on writing paper, I have trouble doing it on matlab

#### 0 件のコメント

サインイン to comment.

James Tursa 2019 年 5 月 22 日
Not sure which one is first, but maybe one of these is what you want?
>> mapping1 = [0 1 3 2]
mapping1 =
0 1 3 2
>> mapping2 = [0 3 2 1]
mapping2 =
0 3 2 1
>> mapping1(mapping2+1)
ans =
0 2 3 1
>> mapping2(mapping1+1)
ans =
0 3 1 2

#### 1 件のコメント

hang dong 2019 年 5 月 22 日
thank you very much!

サインイン to comment.

サインイン してこの質問に回答します。

Translated by