Problem with multivariable plots

4 vues (au cours des 30 derniers jours)
cTroels
cTroels le 21 Fév 2020
How do i plot the same function with different values of a constant in a plot?
I have a function, with 2 variable inputs and 2 outputs. I plotted it where i keep the one variable constant, and now i want to plot it keeping the other variable constant, but for multiple values af a constant. Heres the function:
[Gamma, Beta] = Vinkel(n, tid)
n = 1:365;
tid = 0;
Omega = 15*tid;
Phi = 56.3;
Delta = 23.45*sind(360*(284+n)/365;
Theta_z = acosd(cosd(Phi)*cosd(Delta)*cosd(Omega)+sind(Phi)*sind(Delta));
%Sign_Omega gives 1 if Omega is positive and -1 if Omega is negative.
Gamma = Sign_Omega(Omega)*(acosd((cosd(Theta_z)*sind(Phi)-sind(Delta))/(sind(Theta_z)*cosd(Phi))))
Figure
plot(n,Theta_z)
Now i want to plot Gamma and Theta_z for tid = -12:12 for n = 171 and 356.

Réponse acceptée

Samatha Aleti
Samatha Aleti le 25 Fév 2020
Hi,
According to my understanding you are trying to plot each output “Gamma” and “Theta_z” by changing 2 inputs “tid and “n”. You can do so by using “hold on. Here is a sample code:
tid = 2:2:8; % Let
n = [1 4]; % Let
Theta_z = tid.*n(1); % Let: for 1st value of n
plot(tid,Theta_z);
hold on
Theta_z = tid.*n(2); % Let: for 2nd value of n
plot(tid,Theta_z);
legend('n = 1','n=4');
hold off

Plus de réponses (1)

ashkan mohammadi
ashkan mohammadi le 28 Fév 2020
how do i plot this multivariable equation : ax^3-bx^2+3x(3-i^2)-1+i^2
i tried to used polynomial for finding the root of this above equation but i got matlab error..
in fact i'm gonna find x for different value of i, and then plotting x versus i ????

Community Treasure Hunt

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

Start Hunting!

Translated by