Hello everyone.
I am trying to work on plotting my graph with specific function.
T1 = 1/(T*7.74809172e-5)*(0.1491e-14) % this is the function that I want to use.
This is the code that I used to plot graph.
clear all
file = readtable('si_100_trans.xlsx');
x_raw = table2array(file(1:301,1));
T_raw = table2array(file(1:301,2));
E = x_raw-0.6;
T = T_raw;
T1 = 1/(T*7.74809172e-5)*(0.1491e-14)
T1 = 1×301
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
plot(E,T1)
However, when I checked command window, all of the value on T1 showed 0 except just 5.8029 at the end.
I thought that the function was the problem, but when I calculated each value, the function showed results with nonzero values.
Can anyone help me with these problems?
Thank you.

 채택된 답변

Selena Mastrodonato
Selena Mastrodonato 2024년 1월 25일

2 개 추천

Try adding the dot for the element-wise division: 1./(T*7.74809172e-5)*(0.1491e-14)
file = readtable('si_100_trans.xlsx');
x_raw = table2array(file(1:301,1));
T_raw = table2array(file(1:301,2));
E = x_raw-0.6;
T = T_raw;
T1 = 1./(T*7.74809172e-5)*(0.1491e-14);
plot(E,T1)

댓글 수: 3

changmin lim
changmin lim 2024년 1월 25일
Thank you very much!
I didn't expect that dot was the problem.
From the question, I mentioned that using this equation with typing every single value without using dot division( ex. 1/(0.7*7.74809172e-5)*(0.1491e-14)) also showed proper answers.
Are there some important differences btw dot division and without dot division?
Selena Mastrodonato
Selena Mastrodonato 2024년 1월 25일
You want to divide 1 for every single element of array T, so you use dot for element-wise division. You can read Array vs. Matrix Operations to understand array operations.
changmin lim
changmin lim 2024년 1월 25일
Thank you!!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2024년 1월 25일

댓글:

2024년 1월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by