Plotting y = kx

17 次查看(过去 30 天)
Behnaz Seyedahmadi
Behnaz Seyedahmadi 2020-10-4
I am trying to reproduce the following graph, which is a plot of some function like: y = kx, with both varying 'k' and 'x'. Can someone help me in this?
  2 个评论
Walter Roberson
Walter Roberson 2020-10-5
Can you do it parametrically, k = K(t), x = X(t), hence y = K(t).*X(t) ?
Behnaz Seyedahmadi
Behnaz Seyedahmadi 2020-10-5
it is simpler than taht, I dont know why I am stuck in it, it is this way:
0<k<1000
0<x<20225
y = k.* x
but I dont know how to match the x and K size?

请先登录,再进行评论。

回答(2 个)

Walter Roberson
Walter Roberson 2020-10-5
N = 150;
kvec = linspace(0, 1000, N);
xvec = linspace(0, 20225, N);
[k, y] = meshgrid(kvec, xvec);
y = k .* x;
nlevels = 50;
contour(k, y, nlevels)

Sulaymon Eshkabilov
k=1:999;
x =1:2024;
F = k.* x(:);
N = 25;
contour(k, x, F, N), shg
xlabel('k stifness'), ylael(' ...')

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by