Borrar filtros
Borrar filtros

Not changing angle value

11 visualizaciones (últimos 30 días)
Esila Darci
Esila Darci el 12 de Jul. de 2022
Comentada: Rena Berman el 4 de En. de 2024
Hello all,
I am putting two sets of variable and conditions. If conditions satisfy then it should show that respective value, but it shows only the respective value from "allpossibleV" only and for angle it shows only 0 to 1 only but it should show at all 0 , 1 , 2, 3, 4 , and 5 . Anyone can help me here?
[n,m]=size(deltax);
Unrecognized function or variable 'deltax'.
allPossibleV = [25 : 1 : 26]
for vIndex = 1 : length(allPossibleV)
V_new = allPossibleV(vIndex);
end
splitterangle = [0 : 1 : 5]
for i=1:n
X1=deltax(i,1); X2=deltax(i,2);
for angleIndex = 1 : length(splitterangle)
angle_new = splitterangle(angleIndex)
opposite_side = sind(angle_new)*0.102;
separation_distance = opposite_side + 0.015;%
X3=separation_distance
if X1<X3 && X2>X3
disp([' Successful at ' num2str(allPossibleV(i)) ' and ' num2str(splitterangle(i)) ' angle'])
end
end
end
  4 comentarios
Stephen23
Stephen23 el 30 de Dic. de 2023
Editada: Stephen23 el 30 de Dic. de 2023
Original question by Esila Darci retrieved from Google Cache:
Not changing angle value
Hello all,
I am putting two sets of variable and conditions. If conditions satisfy then it should show that respective value, but it shows only the respective value from "allpossibleV" only and for angle it shows only 0 to 1 only but it should show at all 0 , 1 , 2, 3, 4 , and 5 . Anyone can help me here?
[n,m]=size(deltax);
Unrecognized function or variable 'deltax'.
allPossibleV = [25 : 1 : 26]
for vIndex = 1 : length(allPossibleV)
V_new = allPossibleV(vIndex);
end
splitterangle = [0 : 1 : 5]
for i=1:n
X1=deltax(i,1); X2=deltax(i,2);
for angleIndex = 1 : length(splitterangle)
angle_new = splitterangle(angleIndex)
opposite_side = sind(angle_new)*0.102;
separation_distance = opposite_side + 0.015;%
X3=separation_distance
if X1<X3 && X2>X3
disp([' Successful at ' num2str(allPossibleV(i)) ' and ' num2str(splitterangle(i)) ' angle'])
end
end
end
Original comment retrieved from Google Cache:
@Rik , thanks.
deltax has the function that given the following value
0.0153799925086085 0.0165703972540118 (at 25 allPossibleV)
0.0133063614315573 0.0179011999654362 (at 26 allPossibleV)
but why in the output it is showing only
angle_new = 0
X3 =0.015
angle_new =1
X3 = 0.0167801454566029
Successful at 25 and 0 angle
angle_new = 2
X3 =0.0185597486636551
Successful at 25 and 0 angle
angle_new = 3
X3 =0.0203382675367803
Successful at 25 and 0 angle
angle_new = 4
X3 =0.0221151603219008
Successful at 25 and 0 angle
angle_new =5
X3 =0.0238898857602611
Successful at 25 and 0 angle
angle_new = 0
X3 = 0.015
Successful at 26 and 1 angle
angle_new =1
X3 =0.0167801454566029
Successful at 26 and 1 angle
angle_new =2
X3 = 0.0185597486636551
Successful at 26 and 1 angle
angle_new = 3
X3 = 0.0203382675367803
Successful at 26 and 1 angle
angle_new =4
X3 = 0.0221151603219008
Successful at 26 and 1 angle
angle_new =5
X3 =0.0238898857602611
Successful at 26 and 1 angle
However, as you can see the angle_new always changes 0 ,1,2,3,4, and 5 but in the sentence, it always 0 and 1 angle "Successful at 25 and 0 angle" and "Successful at 26 and 1 angle". So it should change like
"Successful at 25 and 0 angle"
"Successful at 25 and 1 angle"
"Successful at 25 and 2 angle"
"Successful at 25 and 3 angle"
"Successful at 25 and 4 angle"
"Successful at 25 and 5 angle"
"Successful at 26 and 0 angle"
"Successful at 26 and 1 angle"
"Successful at 26 and 2 angle"
"Successful at 26 and 3 angle"
"Successful at 26 and 4 angle"
"Successful at 26 and 5 angle"
How can i change it ? ( I have added the delatax value alaready, you can use it that)
Thanks a ton.
Rena Berman
Rena Berman el 4 de En. de 2024
(Answers Dev) Restored edit

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 12 de Jul. de 2022
Try this:
% Demo by Image Analyst
% Initialization Steps.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
deltax = [
5086085 0.0165703972540118; ... % (at 25 allPossibleV)
0.0133063614315573 0.0179011999654362] % (at 26 allPossibleV)
[n,m]=size(deltax);
allPossibleV = [25 : 1 : 26]
for vIndex = 1 : length(allPossibleV)
V_new = allPossibleV(vIndex);
end
splitterangle = [0 : 1 : 5]
for k=1:n
X1=deltax(k,1);
X2=deltax(k,2);
for angleIndex = 1 : length(splitterangle)
angle_new = splitterangle(angleIndex)
opposite_side = sind(angle_new)*0.102;
separation_distance = opposite_side + 0.015;%
X3=separation_distance;
fprintf('X1 = %.3f. X2 = %.3f. X3 = %.3f. X1<X3 = %d, X2>X3 = %d.\n', X1, X2, X3, X1<X3, X2>X3)
if X1<X3 && X2>X3
fprintf(' Conditions met, so was successful at %d, and new_angle = %d degrees.\n', allPossibleV(k), angle_new)
else
fprintf(' Condition not met, so was unsuccessful at %d, and new_angle = %d degrees.\n', allPossibleV(k), angle_new)
end
end
end

Categorías

Más información sobre Graphics Object Properties en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by