need to draw lattice diagram in matlab for txt file
18 次查看(过去 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?
采纳的回答
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.
You can refer to this for plotting arrows: https://www.mathworks.com/matlabcentral/answers/92988-how-do-i-plot-a-line-that-has-an-arrow-on-the-end-of-it-in-2-d-and-3-d
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
0 个评论
更多回答(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 个评论
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);
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!