ccdesign help to create this calculation

1 回表示 (過去 30 日間)
MINATI PATRA
MINATI PATRA 2024 年 5 月 8 日
回答済み: Shivani 2024 年 6 月 18 日
exp = ccdesign(3,'type','circumscribed'); exp(exp>=1) = 1; exp(exp<=-1) = - 1;
EXP = subs(exp,{-1,0,1},vpa({0.01,0.02,0.03}));
%% I want to recreate 'exp' by 'EXP' to write in an excel sheet created by Matlab
%% Want Matlab to create an excel sheet with variable names as 'p1', 'p2', and 'p3', then in next column calculate N
A = 1; B = 2.5; C = 0.001; N = A.p1 + B.p2 + C.p3; % and then want the surf plot
figure(1),surfc(N),xlim(-1,1),ylim(-1,1)

採用された回答

Shivani
Shivani 2024 年 6 月 18 日
To achieve the intended results, kindly refer to the code snippet provided below. This implementation is based on my understanding of the question you've posted:
exp = ccdesign(3,'type','circumscribed');
exp(exp >= 1) = 1;
exp(exp <= -1) = -1;
% Assuming you want to map -1, 0, 1 to 0.01, 0.02, 0.03, respectively
EXP = exp;
EXP(exp == -1) = 0.01;
EXP(exp == 0) = 0.02;
EXP(exp == 1) = 0.03;
T = array2table(EXP, 'VariableNames', {'p1', 'p2', 'p3'});
% Write the table to an Excel file
filename = 'experiment_design.xlsx';
writetable(T, filename);
A = 1; B = 2.5; C = 0.001;
% Calculate N using vectorized operations
N = A * T.p1 + B * T.p2 + C * T.p3;
% Add N as a new column to your table
T.N = N;
writetable(T, 'experiment_design_with_N.xlsx');
Creating a surface plot using 'surfc' directly from the variable (N) as you've described isn't straightforward because (N) is calculated from the experimental design and doesn't directly map to a grid of (p1), (p2), and (p3) values. Usually, surface plots are created from functions of two variables (e.g., (f(x, y))), but your calculation involves three parameters ((p1), (p2), (p3)). Therefore, as per my knowledge, it may not be possible to plot a surface plot directly.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by