필터 지우기
필터 지우기

how to write equation in matlab ?

조회 수: 3 (최근 30일)
ajeet verma
ajeet verma 2017년 11월 17일
편집: ajeet verma 2017년 11월 17일
i have an equation and trying to write in matlab but i am not getting desired result so please help me.
please find attached file for equation and result shown in red line in figure for that equation.
i am trying like
r=1000;
c=1000;
p=32;
m=8;
for i= 1:r
for j=1:c
if mod(i/(m*p),2) %odd
SP(i,j)=-pi+round((i/p)+1)*(2*pi/m) ;
else % even
SP(i,j)=pi-round(i/p)*(2*pi/m);
end
end
end
figure(1)
plot(SP)
  댓글 수: 2
Walter Roberson
Walter Roberson 2017년 11월 17일
In mathematics, [] indicates grouping, but does not indicate rounding unless the paper defines it as rounding. The related symbols
_ _
| x | |_ x _|
are ceiling and floor, but [ ] is not generally rounding.
Walter Roberson
Walter Roberson 2017년 11월 17일
I have sometimes seen [A\B] notation used to indicate the size of the equivalence class of A induced by B . In graph theory it could have to do with the something about the number of vertices or edges in a graph in which B had been removed.

댓글을 달려면 로그인하십시오.

채택된 답변

Roger Stafford
Roger Stafford 2017년 11월 17일
편집: Roger Stafford 2017년 11월 17일
I am guessing that brackets in this case means the same as 'floor', so your code would then be something like this:
m = 8;
P = 32;
x = linspace(0,1000,5000);
SP = zeros(1,length(x));
for i = 1:length(x)
if mod(floor(x(i)/(m*P)),2) == 0
SP(i) = pi-floor(x(i)/P)*2*pi/m;
else
SP(i) = -pi+(floor(x(i)/P)+1)*2*pi/m;
end
end
plot(x,SP)
I don't know how y enters into this.
  댓글 수: 4
Roger Stafford
Roger Stafford 2017년 11월 17일
편집: Roger Stafford 2017년 11월 17일
Added Note: My computer doesn't generate the plot shown in your image.png. Either something is wrong with the given formula, or my interpretation of the bracket symbols is in error. The image's blue curve is just the sort of function that is needed to make the needed correction to the given formula to get the orange curve, so I suspect the trouble lies with the formula.
ajeet verma
ajeet verma 2017년 11월 17일
편집: ajeet verma 2017년 11월 17일
here two curve blue and orange obtained from two different equations are shown in one figure as attached. i reattach the equations in which equation 6 for orange color and equation 7 is for blue color. so i am able to create code for blue color but problem is in orange color curve. please find attached file code for blue curve
%% stair phase-2 clc; clear all; r=1024; p=256; m=1; n=4; for i= 1:r SP2(i) = pi-floor(i/(m*p))*(2*pi/n); end plot(SP2,'b')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by