how to write equation in matlab to get the required graph ?
Afficher commentaires plus anciens
i have some equations and corresponding graph, i am trying to find graph using that equations and i found second graph (green) correctly but in first graph (red color) something being wrong, i am unable to detect the problem, so please help....... my code is:
clc;
clear all;
r=1024;
c=1024;
p=32;
m=8;
for i= 1:r
for j=1:c
if mod(i/(m*p),2) %even
SP(i,j) = pi-round((i/p)*2*pi/m) ;
else % odd
SP(i,j)=-pi+round(((i/p)+1)*2*pi/m) ;
end
end
end
figure(1),plot(SP,'r')
hold on
%%stair phase-2
p=256;
m=1;
n=4;
for i= 1:r
for j=1:c
SP1(i,j) = pi-round(i/(m*p))*(2*pi/n);
end
end
plot(SP1,'g')
hold off
Réponse acceptée
Plus de réponses (0)
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!