# need to draw lattice diagram in matlab for txt file

26 ビュー (過去 30 日間)
Venkatkumar M 2020 年 6 月 30 日

I need to draw Bewley lattice diagram for given data using matlab code could anyone please idea.
I have attached txt file which has 3 coloumns each coloumn is total volatge at one node in transmission line so far each column i need draw a latice diagram.
fnm = 'sourceoc.txt ';
D4 = load(fnm);
m=(D4(:,1));
n=(D4(:,2));
o=(D4(:,3));
c=3e8;
f=2e9;
lambda=c/f;
dx=lambda/10;
dt=dx/c;
ts = 1:size(D4,1);
L = numel(ts) ;
Ts = dt;
from here plot has to be drawn?
Could anyone please help in developing the code?
##### 2 件のコメントなしを表示なしを非表示
Mike Sasena 2020 年 8 月 17 日
Hi Venkatkumar,
This looks like a power electronics issue, so I'm assing Simscape Electrical to the product list so that team can more easily find your question. You'll also need to check the attached file. It's all zeros. You probably saved it with a formatting which truncated all the significant digits past the 4th decimal place. Lastly, your sample code show "ts = 1:size(D2,1)", but never defines the variable D2. Can you clarify that code?
Venkatkumar M 2020 年 8 月 17 日
its not D2 its D4.
its comes zeros and values,you can see values in between

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

### 採用された回答

Joel Van Sickel 2020 年 9 月 2 日
Hello Venkatkumar,
our tools don't support plotting Beweley lattice diagrams so you will have to come up with your own way of plotting them. You will need to calculate the locations of the arrows.
and in general, the plot command has many feautres for editing line format that can be used for the diagram. You should probably translate location in the matrix to a certain number of pixels when calculating where your arrows should go. If you are not familiar with plotting in Matlab, here is a basic overview: http://www.math.lsa.umich.edu/~tjacks/tutorial.pdf
Regards,
Joel

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

### その他の回答 (2 件)

Mohsen 2023 年 5 月 18 日
temperature = [100 90 80 70 60 50 40 30 20 10 0];
time = [0 10 20 30 40 50 60 70 80 90 100];
coefficients = polyfit(time, temperature, 1);
x_values = linspace(0, 100, 100);
y_values = polyval(coefficients, x_values);
plot(time, temperature, 'o', x_values, y_values);
xlabel('time');
ylabel('temperature');
##### 0 件のコメント-2 件の古いコメントを表示-2 件の古いコメントを非表示

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

Mohsen 2023 年 5 月 18 日
temperature = [100 90 80 70 60 50 40 30 20 10 0];
time = [0 10 20 30 40 50 60 70 80 90 100];
coefficients = polyfit(time, temperature, 1);
x_values = linspace(0, 100, 100);
y_values = polyval(coefficients, x_values);
plot(time, temperature, 'o', x_values, y_values);

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

### カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

R2018a

### Community Treasure Hunt

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

Start Hunting!

Translated by