How to plot a table to a graph?

4 ビュー (過去 30 日間)
Mitchell Lawrence
Mitchell Lawrence 2017 年 11 月 13 日
回答済み: Walter Roberson 2017 年 11 月 27 日
I created a code and am wanting to graph this analytical solution and a modeled solution on the same graph. Currently when I try to graph the data it outputs the table that I imported from a .dat attached is the file.
SH = 45*10^6;
Sh = 30*10^6;
theta = 90;
R = 1;
r = linspace(1,6);
hoop =.5*(SH+Sh)*(1+R.^2./r.^2)-.5*(SH-Sh)*(1+3*R.^4./r.^4)*cos(2*theta);
plot(r, hoop,HW9(:,1),HW9(:,2))
title('Hoop Stress')
xlabel('Distance from wellbore in terms of r')
ylabel('Hoop Values')
  1 件のコメント
Maitreyee Mordekar
Maitreyee Mordekar 2017 年 11 月 27 日
Hi Mitchell,
Could you explain a little more about your workflow on what is the exact output you observe and the output that you expect?
Also, can you please attach the .dat file that you are trying to import into MATLAB?

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

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 11 月 27 日
If HW9 is a MATLAB table object then you probably need
plot(r, hoop,HW9{:,1},HW9{:,2})

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by