필터 지우기
필터 지우기

how to write equation in matlab?

조회 수: 1 (최근 30일)
ajeet verma
ajeet verma 2017년 9월 11일
댓글: ajeet verma 2017년 9월 11일
i have an equation as attached in file that i am trying to write in matlab but something being wrong, please help how to write???
  댓글 수: 2
Geoff Hayes
Geoff Hayes 2017년 9월 11일
ajeet - is there anything more to this equation? Is r0 a matrix or a function? If a matrix, then presumably x and y are integers and so your equation could be written as
x = 1;
y = 2;
r0 = rand(4,4); % sample data to illustrate problem
r = zeros(4,4);
R = 1;
r(x,y) = 2 * round((R - 1) / 2) + ((-1)^(R + 1)) * r0(x,y);
But how is R used. You mention that R is equal to 1,2,3,4. Does this mean that you have 4 matrices (of r) where you use different values of R. Or is have you omitted a summation? Please clarify.
ajeet verma
ajeet verma 2017년 9월 11일
for more detail i attached all equation and corresponding graph as i required, my problem is in last equation(5), i am not getting figure d using equation(5), i am showing my code below, now please help if you can, my code is :
%TWO STEP PHASE SHIFTING TRIANGULAR TECHNIQUE (WAVE FORM) %% STEP FIRST clc; clear all; Imax=0.8; Imin=0.2; Im=Imax-Imin; T = 20; s1= @(x) ((2*Im*x/T)+Imin+Im/2).*(0<=x & x<=T/4) +((-2*Im*x/T)+Imin+3*Im/2).*(T/4<=x & x<=3*T/4)+((2*Im*x/T)+Imin-3*Im/2).*(3*T/4<=x & x<=T); s2= @(x) ((-2*Im*x/T)+Imin+Im/2).*(0<=x & x<=T/4) + ((2*Im*x/T)+Imin-Im/2).*(T/4<=x & x<=3*T/4)+((-2*Im*x/T)+Imin+5*Im/2).*(3*T/4<=x & x<=T); x = linspace(0, 20); X = repmat(x, 1000, 10); I1 = s1(x); I2 = s2(x); figure(1),plot(x,I1) figure(2),plot(x,I2) %% STEP-2 (wrapped map) r=abs(I1-I2)/Im; figure(3),plot(x,r) %% STEP-3 (intensity ratio) R=2; up=2*round((R-1)/2)+((-1)^R+1)*r; figure(4),plot(x,up)

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by