How to correct X and Y matrix to plot a curve that start at (0,0) as a original point?

1 回表示 (過去 30 日間)
Let's say I have X and Y data. The minimum value of them may be around 0.001 for X and 15 for Y. I want to plot X and Y that start at (0,0). Please let me know how to do that. I am still subordinate to matlab since I am quite new to it.

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 10 月 27 日
MATLAB can only plot the points you give it. If you want it to start at (0,0), then include those points in your X and Y data.
% Sample data
X = 0.001:0.001:0.005;
Y = 15:19;
% Prepend data with 0
X = [0 X];
Y = [0 Y];
% Plot
plot(X,Y)

その他の回答 (1 件)

Mathieu NOE
Mathieu NOE 2021 年 10 月 27 日
hello
try this
clc
clearvars
skip = 1;
data = csvread('highstrain(0.1s^-1).csv',skip);
X = data(:,1);
Y = data(:,2);
% make X, Y data start at zero
X = X - min(X);
Y = Y - min(Y);
plot(X,Y)
  3 件のコメント
ans
ans 2021 年 10 月 27 日
Thanks. It works well.
Mathieu NOE
Mathieu NOE 2021 年 10 月 28 日
yes
that was my opinion too...:)

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

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by