how to write equation in matlab to get the required graph ?
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!