Matlab Matrix plot from a for-loop
Afficher commentaires plus anciens
Foto Hello everyone! I just need to make a matrix from my code. The x from 1 to 30 is actually my index. I need a proper y filled with zeros allong and only at i index filled with X Value. Hopefully you could understand me.
3 commentaires
KALYAN ACHARJYA
le 14 Nov 2021
Modifié(e) : KALYAN ACHARJYA
le 14 Nov 2021
Can you please clarify more?
Rotari Elena
le 14 Nov 2021
KALYAN ACHARJYA
le 14 Nov 2021
matrix=zeros(1,30);
Réponses (1)
KALYAN ACHARJYA
le 14 Nov 2021
pi_aprox=zeros(1,30);
n=6;
g2n=zeros(1,30);
U_neue=zeros(1,30);
g2n(1)=1;
for i=1:30
U_neue(i)=n*g2n(i);
pi_aprox(i)=U_neue(i)/2;
n=n*2;
g2n(i)=sqrt(2-sqrt(4-g2n(i)^2));
end
Please change as per requirements
4 commentaires
Rotari Elena
le 14 Nov 2021
KALYAN ACHARJYA
le 14 Nov 2021
Please share the complete code
Rotari Elena
le 14 Nov 2021
KALYAN ACHARJYA
le 14 Nov 2021
Modifié(e) : KALYAN ACHARJYA
le 14 Nov 2021
x=1:1:30;
y=zeros(1,30);
plot(x,y);
Any sense?
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!