Borrar filtros
Borrar filtros

what is wrong with my code ?

2 visualizaciones (últimos 30 días)
ajeet verma
ajeet verma el 31 de Ag. de 2017
Editada: ajeet verma el 31 de Ag. de 2017
i generate a code to get the desired result as given in attached file but there is some problems in step-3, and i am unable to find desired result from step-3 so please help me where am i wrong, my code is here:
%
% 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)
r0=abs(I1-I2)/Im;
figure(3),plot(x,r0)
%%STEP-3 (intensity ratio)
R=2;
r=2*round((R-1)/2)+((-1)^R+1)*r0;
figure(4),plot(x,r)
please find attachments
  2 comentarios
KSSV
KSSV el 31 de Ag. de 2017
r is not defined in step 3.....
ajeet verma
ajeet verma el 31 de Ag. de 2017
it is by mistake and here r is r0 as defined above. but taking r0 result is not coming

Iniciar sesión para comentar.

Respuesta aceptada

John D'Errico
John D'Errico el 31 de Ag. de 2017
Editada: John D'Errico el 31 de Ag. de 2017
Just explaining what KSSV said:
r=2*round((R-1)/2)+((-1)^R+1)*r;
See that r lies on BOTH sides of the equality here. But since it has never been used before, what is r? Should MATLAB somehow be smart enough that it can solve for r here? Or is that a typo? Never ask a computer to magically determine what you really intended to do, even if what you intended is not what you wrote. (The mind reading toolbox is not yet out of beta test stage.)
  1 comentario
ajeet verma
ajeet verma el 31 de Ag. de 2017
it is by mistake and here r is r0 as defined above. but taking r0 result is not coming

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by