how use MATLAB to data generation

조회 수: 1 (최근 30일)
dodo shu
dodo shu 2019년 9월 13일
답변: Cam Salzberger 2019년 9월 13일
Is it possible to use MATLAB to generate a set of data with the corresponding relation of y=sin(x), and then import it into excel?

채택된 답변

Cam Salzberger
Cam Salzberger 2019년 9월 13일
Hello Dodo,
Yes, if you are looking to evaluate the sine function at particular points, then export that data to an Excel spreadsheet, you can do all that in MATLAB. For a very basic example:
x = linspace(0, 2*pi, 100);
y = sin(x);
writematrix(y, "MyExcelFile.xlsx")
If you have an older verison of MATLAB, you may want to use xlswrite instead of writematrix. You can modify the input datapoints to the sine function by changing how you define x, and even do degrees as units if you use "sind" instead of "sin". You can also modify where and how the data is written to the Excel file by adding options to writematrix.
-Cam

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by