How to plot every combination of a function?

3 ビュー (過去 30 日間)
Jannen Paiva
Jannen Paiva 2015 年 3 月 13 日
コメント済み: Jannen Paiva 2015 年 3 月 13 日
x= A + cos(theta) y= sin(theta) - A
The x and y coordinates are parametrised by A and theta
Is there a way to plot graphs for every combination of 0<A<20 and 0<theta<360 ?

回答 (2 件)

Image Analyst
Image Analyst 2015 年 3 月 13 日
Have you tried meshgrid to give every combination:
a = 1:2:20
th = 0:20:360;
[A, theta] = meshgrid(a, th);
x= A + cos(theta);
y= sin(theta) - A
plot(x, y);
  1 件のコメント
Jannen Paiva
Jannen Paiva 2015 年 3 月 13 日
Would this also work if x and y were parametrised by any number of variables? eg. (a, b, c, th1, th2)

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


Star Strider
Star Strider 2015 年 3 月 13 日
For all values of both variables, you get a patch plot:
x = @(theta,A) A + cosd(theta);
y = @(theta,A) sind(theta) - A;
theta = linspace(0, 360, 360);
figure(1)
subplot(2,1,1)
patch([theta, fliplr(theta)], [x(theta,0), fliplr(x(theta,20))], 'b')
title('X')
axis([0 360 ylim])
grid
subplot(2,1,2)
patch([theta, fliplr(theta)], [y(theta,0), fliplr(y(theta,20))], 'b')
title('Y')
axis([0 360 ylim])
grid

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by