MATLAB Answers

타원형 평면 콘타를 그리고싶습니다.

1 view (last 30 days)
JONGHO LEE
JONGHO LEE on 3 Feb 2020
안녕하세요.
아래 스크립트와 같이 원형 콘타를 그리는것처럼 타원형도 그리고싶습니다.
clear; clc; close all; tic;
%%%%%%%%%%%%%%%%%%%%
Href = '40';
Href_temp = (40:40:240)';
flow = 'II';
%%%%%%%%%%%%%%%%%%%% load the file
cd 'D:\wind_paper\elips\a0.21\all data';
for kHref = 1 : length(Href_temp)
Href = num2str(Href_temp(kHref));
load(['PElipOpen0Href' Href '_deg010_rpm750_01.mat']);
mCp = mean(minCp(1:10, 3:207));
L1(:, 1) = mCp(1:18);
L2(:, 1) = [mCp(1) mCp(19:35)];
L3(:, 1) = [mCp(1) mCp(36:52)];
L4(:, 1) = [mCp(1) mCp(53:69)];
L5(:, 1) = [mCp(1) mCp(70:86)];
L6(:, 1) = [mCp(1) mCp(87:103)];
L7(:, 1) = [mCp(1) mCp(104:120)];
L8(:, 1) = [mCp(1) mCp(121:137)];
L9(:, 1) = [mCp(1) mCp(138:154)];
L10(:, 1) = [mCp(1) mCp(155:171)];
L11(:, 1) = [mCp(1) mCp(172:188)];
L12(:, 1) = [mCp(1) mCp(189:205)];
LineAll = [L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12];
%%%%%%%%%%%%%%%%%%%% axis
R = (0:2:34)'*(200/34); % mm
deg1 = deg2rad((90:-30:0))'; % L1 - L4
deg2 = deg2rad((30:30:90))'; % L5 - L7
deg3 = deg2rad((60:-30:0))'; % L8 - L10
deg4 = deg2rad((30:30:60))'; % L11 - L12
%%%%% L1 - L4
for kdeg = 1 : length(deg1)
for kR = 1 : length(R)
x(kR, kdeg) = R(kR)*cos(deg1(kdeg));
z(kR, kdeg) = -R(kR)*sin(deg1(kdeg));
end
end
%%%%% L5 - L7
for kdeg = 1 : length(deg2)
for kR = 1 : length(R)
x(kR, 4+kdeg) = R(kR)*cos(deg2(kdeg));
z(kR, 4+kdeg) = R(kR)*sin(deg2(kdeg));
end
end
%%%%% L8 - L10
for kdeg = 1 : length(deg3)
for kR = 1 : length(R)
x(kR, 7+kdeg) = -R(kR)*cos(deg3(kdeg));
z(kR, 7+kdeg) = R(kR)*sin(deg3(kdeg));
end
end
%%%%% L11 - L12
for kdeg = 1 : length(deg4)
for kR = 1 : length(R)
x(kR, 10+kdeg) = -R(kR)*cos(deg4(kdeg));
z(kR, 10+kdeg) = -R(kR)*sin(deg4(kdeg));
end
end
tx = -200 : 1 : 200;
tz = -200 : 1 : 200;
[XI, ZI] = meshgrid(tx, tz);
ZZ(:, :, kHref) = griddata(x, z, LineAll, XI, ZI, 'linear');
end
%%%%%%%%%%%%%%%%%%%%
figure('unit','centimeters','position',[0, 0, 30, 45]);
TXT = 15; LW = 1; MS = 7;
ct_intvl = (-1.6 : 0.1 : 0.5);
v = (-1.4 : 0.2 : 0.2);
%%%%%%%%%%
for k = 1 : 6
subplot(3, 2, k);
[C, H] = contourf(XI, ZI, ZZ(:, :, k), ct_intvl, 'k');
set(H, 'linestyle','--','linewidth', LW);
clabel(C, H, v, 'fontname', 'times', 'fontweight', 'bold', 'fontsize', TXT);
set(gca, 'visible', 'off');
% ht = title('XCOR-0LAG Static model');
% set(ht, 'visible', 'on', 'fontweight', 'bold', 'fontsize', TXT-15, 'fontname', 'times');
set(gcf, 'color', 'w');
hold on;
t = linspace(0,2*pi,200);
cx = 0; cy = 0; % 뭷륲
r = 200; % 뵾똞, mm
plot(r*sin(t)+cx, r*cos(t)+cy,'k','linewidth', LW)
axis square
caxis([min(ct_intvl), max(ct_intvl)]);
hclbar = colorbar;
set(hclbar, 'ytick', v, 'location', 'eastoutside', 'visible', 'on', 'fontname', 'times','fontweight', 'bold','fontsize', TXT-2);
end
%%%%%%%%%%%%%%%%%%%% save as .bmp
% fig1 = sprintf(['../201812_WindSymposium/WindSympo_Figures/WindSympo HrefAll_' flow ' meanCp']);
fig1 = sprintf('1');
set(gcf,'PaperType','A4');
set(gcf,'PaperPositionMode','auto');
print('-dmeta','-r250',fig1);
% %%%%%%%%%%%%%%%%%%%
%
% cd 'F:\THESIS\00 WindTunnelData [20180509]\2017 9 Retractable Dome TPU\201812_WindSymposium';
%
% toc;
%
% %%%%%%%%%%%%%%%%%%% EOF
-------------------------------------------------------------------------이까지가 원형 콘타를 그렸던 스크립트입니다------------------------------------------------------------------------------
아마도
x(kR, kdeg) = R(kR)*cos(deg1(kdeg));
z(kR, kdeg) = -R(kR)*sin(deg1(kdeg));
이 부분에서 수정이 되어야할것같은데, 수학적 개념이 별로 없어서 어렵습니다.
어떻게 수정을 하면 타원형을 구하는 식이 될까요?
읽어주셔서 감사합니다.

  0 Comments

Sign in to comment.

Answers (0)

Sign in to answer this question.