need to draw lattice diagram in matlab for txt file

26 vues (au cours des 30 derniers jours)
Venkatkumar M
Venkatkumar M le 30 Juin 2020
Réponse apportée : Mohsen le 18 Mai 2023
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 commentaires
Mike Sasena
Mike Sasena le 17 Août 2020
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
Venkatkumar M le 17 Août 2020
its not D2 its D4.
its comes zeros and values,you can see values in between

Connectez-vous pour commenter.

Réponse acceptée

Joel Van Sickel
Joel Van Sickel le 2 Sep 2020
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

Plus de réponses (2)

Mohsen
Mohsen le 18 Mai 2023
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');

Mohsen
Mohsen le 18 Mai 2023
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);

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by