2d plot from 1d plot

Hello all.
I have one vector as a function of x of length 1220 point and another vector as a function of y of length 1933 point. These points are arbitrary measure of my x and y distance respectively. I want to multiply them together to get a third vector of x and y, then I want to plot with x and y. Any help how can I do it will be appreciated.

1 件のコメント

omnia
omnia 2016 年 11 月 26 日
Note that my x and y distance are different from each other.

サインインしてコメントする。

回答 (1 件)

Star Strider
Star Strider 2016 年 11 月 26 日

0 投票

‘Note that my x and y distance are different from each other.’
The interp1 function is your friend here.

6 件のコメント

omnia
omnia 2016 年 11 月 26 日
yes but how I can multiply them? they are of different sizes as x distance and y distance are different?
Star Strider
Star Strider 2016 年 11 月 26 日
It depends on how you want to ‘multiply’ them. You can certainly create a (1220 x 1933) matrix, but if you want to do element-wise multiplication, they have to have the same lengths. That is the reason I suggested interp1 as a way to equalise their lengths.
How you want to do that is your choice.
omnia
omnia 2016 年 11 月 26 日
I can make them of the same length but the resolution will not be the same for both of them. If I skip this point how can I draw them with x and y?
Star Strider
Star Strider 2016 年 11 月 26 日
It depends on what you mean by ‘resolution’. In engineering, it’s frequently necessary to make compromises to accommodate the constraints of the problem.
If you want to multiply them using element-wise operation, the two vectors must both have the same number of elements.
As Walter Cronkite (a U.S. television presenter) used to say, ‘That’s the way it is.’
omnia
omnia 2016 年 11 月 27 日
let me describe the problem in better way. I have two field, one in x direction described over length w, and the other in y described over range h. I have two plots of them which I am attaching. What I want to do is multiply them together over the rectangle of area w*h. My question is how to multiply them?
<<
<<
>>
>>
Star Strider
Star Strider 2016 年 11 月 27 日
I can’t suggest anything other than what I already posted. It seems to me that you are doing matrix multiplication, so that something like this is what you want:
m = w(:) * h(:)';
This will produce matrix ‘m’ that has ‘length(w)’ rows and ‘length(h)’ columns.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

質問済み:

2016 年 11 月 26 日

コメント済み:

2016 年 11 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by