필터 지우기
필터 지우기

How to convert a scalar data into complex ?

조회 수: 41 (최근 30일)
Raj Shankar
Raj Shankar 2012년 6월 28일
Hi
I have 3 coloumns of scalar data, each coloumn belongs to the data of a particular parameter. I have to plot the three parameters in a contour figure. Before that I have to convert the scalar data into a complex one. How shall I do this?

채택된 답변

Wayne King
Wayne King 2012년 6월 28일
A scalar can be complex by definition. A scalar is just a number. So I'm assuming you have real-valued data to start with. How are you going to determine the imaginary part?
You can simply make the attribute complex by
z = randn(100,3);
z = complex(z);
but to actually give it some meaningful imaginary part, you have to some way to assign it.
z = randn(100,3);
z = z+1j*ones(size(z));
  댓글 수: 2
Raj Shankar
Raj Shankar 2012년 6월 28일
Hi Wayne Actually I was instructed to use complex numbered data in the plot so that the plot will become more clear and accurate. I couldn't get the logic of how it is so. But that's why I want the complex data from my scalar. So, which of the ways you told should I prefer?
Wayne King
Wayne King 2012년 6월 28일
You have to have some way of assigning the imaginary part. If you are starting with real valued data, I don't know how you want to assign the imaginary part.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by