Azzera filtri
Azzera filtri

i want to plot this function

1 visualizzazione (ultimi 30 giorni)
sinaraper13
sinaraper13 il 2 Nov 2016
don't no at all about this
  1 Commento
Walter Roberson
Walter Roberson il 5 Nov 2016
Is the right-hand portion intended to be a rewriting of the middle portion, or is it intended that you solve the middle and right hand parts for equality in terms of one of the variables?
At first the right side looks like a rewrite, but if it were a rewrite I would expect the right side to be in terms of sin(theta_t) instead of in terms of sin(theta_i) .
Also if it were a rewrite, I would expect a range restriction to be stated, as the equation cos(x) -> sqrt(1-sin(x)^2) is not valid between Pi/2 and 3*Pi/2. cos(x)^2 = 1 - sin(x)^2 is true, but when you take the square root you have to pay attention to signs.

Accedi per commentare.

Risposte (1)

Nick Counts
Nick Counts il 5 Nov 2016
Sinaraper,
Without going into the mathematics of that function, here is a strategy for tackling a complex plotting task.
  1. Make a vector for the independent variable (In your case, I assume that's theta)
  2. Break up the expression into manageable chunks and assign their values to variables.
  3. Combine the chunks
  4. Plot
Here's a quick example to get you started:
% Step 1: Make an independant variable vector
theta = 0:0.001:2*pi();
% Step 2: Break up the expression into manageable pieces
numerator = cos(theta(1)) - cos(theta);
denomenator = cos(theta(1)) + cos(theta);
% Step 3: Combine the pieces:
expression = numerator ./ denomenator;
% Note the ./ above - this is not matrix division, but going
% element-by-element
% Step 4: Plot!
plot(theta, expression)

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by