i want to plot this function
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
don't no at all about this
1 Kommentar
Walter Roberson
am 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.
Antworten (1)
Nick Counts
am 5 Nov. 2016
Sinaraper,
Without going into the mathematics of that function, here is a strategy for tackling a complex plotting task.
- Make a vector for the independent variable (In your case, I assume that's theta)
- Break up the expression into manageable chunks and assign their values to variables.
- Combine the chunks
- 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)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!