trouble plotting multiple curves on a graph

3 ビュー (過去 30 日間)
Josh
Josh 2019 年 3 月 17 日
コメント済み: Josh 2019 年 3 月 17 日
I am having trouble plotting 2 figures, each has two lines on it. One of the lines in each, y_ext and d_ext use only two points, n=2 and n=100 taken from 1xmatrices. For figure 1 I am seeing curves that are definately inccorrect. I am not sure if I am using linspace correctly perhaps? If someone could take a look at my code that would be much appreciated.
y = linspace(0,L,n+1)
y_ext = -ro*g*y;
figure(1);
hold on;
plot(y, y_ext);
plot(y([2 n]), S_FEM([2 n]));
d_ext = -ro*g/(2*E)*(y.^2-L^2);
figure(2);
hold on;
plot(y, d_ext);
plot(y([2 n]), dnew([2 n]));
  2 件のコメント
madhan ravi
madhan ravi 2019 年 3 月 17 日
please provide the missing datas
Josh
Josh 2019 年 3 月 17 日
Sorry, to be clear S_FEM & dnew are 1x100 matrices, the rest of the variables are constants.

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

回答 (1 件)

Sajeer Modavan
Sajeer Modavan 2019 年 3 月 17 日
There are lot off missing parameters, 'L', 'n', 'ro', 'g', 'E', 'S_FEM' and 'dnew'.
for ploting two points you don't need linespace
eg: n = [2, 100];
y = 2*n+10;
plot(n,y)
so clearly state your question
  1 件のコメント
Josh
Josh 2019 年 3 月 17 日
編集済み: Josh 2019 年 3 月 17 日
Sorry, to be clear S_FEM & dnew are 1x100 matrices, the rest of the variables are constants.

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by