Passing the values in a fixed format

조회 수: 1 (최근 30일)
Ganesh Kini
Ganesh Kini 2020년 6월 24일
답변: Takumi 2020년 6월 24일
I have 2 arrays
Position = {"ITC""VTC""KZT"};
Direction = [0.34 0.56 0.99]
abc = interpn (.. )
I have a pass these values to a interpn function such a way it should pass as set of values, which means i should pass like Position = "ITC" and direction = 0.34 , during the next position = "VTC" and direction = 0.56 and the last one. how do i do that ? please help

답변 (1개)

Takumi
Takumi 2020년 6월 24일
This is sample code.
Is this what you want?
x = linspace(0,2*pi,20);
v1 = sin(x);
v2 = sin(x)/2;
v3 = sin(x)/3;
V = {v1,v2,v3};
for i=1:length(V)
figure(1);
plot(x,V{i});
hold on
end
xq = [1.5, 2.5, 3.5];
for i=1:length(V)
vq = interpn(x,V{i},xq(i));
plot(xq(i),vq,'o');
end

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by