CSVs and data rows

1 次查看(过去 30 天)
Michael
Michael 2015-4-10
评论: Stephen23 2015-4-10
I have a data set in a CSV, comprised of two columns, where the data in the second column is a function of the data in the first column. The data is for MR fluid, so the first column is the strength of the H field, and the second column is resulting yield stress. I need to take an input of amperes, calculate H, compare it to the H column in the CSV, and then output the corresponding yield stress for use in a different part of the program.
Ideally, I would like to be able to extrapolate intermediate H-values and corresponding Yields, but at this point, I just want it to output a Yield when given an H that is already in the CSV.
Any ideas?

回答(1 个)

Michael
Michael 2015-4-10
This seems like it might be what I'm looking for, but it is not quite working yet. It is not throwing an error or anything, but I am still figuring out how to put the data. I've attached the CSV (thought I did that the first time around), and I'm including the Matlab code I have so far (it is still very much a work in progress). If you pay attention to TyH, I need that to be Yield Stress as a function of H, and I need H to be a function of amperes applied to the solenoid. So I give it amperes, it calculated H, goes to the CSV, finds/calculates the Ty for that H, and inputs it into MR fluid equation.
%%Importation
MRdata = csvread('122EG-Tyresponse.csv');
MRdata = sortrows(MRdata,1);
%TyH = interp1(MRdata(:,1),MRdata(:,2),x); %MRdata(:,1) is H, MRdata(:,2) is Ty
TyH = griddedInterpolant(MRdata(:,1),MRdata(:,2),x);
%H = MRdata(:, 1); %H field (kAmp/m)
%Ty = Mrdata(:, 2); %Yield Stress (kPa)
%%Variable Definitions
u0=4*pi*(10^-7); %Magnetic field in a vacuum constant
n=0.042; %Newtonian Viscosity (Pa-s @ 40°C); MR Fluid: ± 0.020
Dv=0:0.001:0.5; %velocity through MR (m/s)
Dz=0.001; %Distance between flow layers (m)
a=0:0.001:1; %Amperes
r=0.01331; %Radius between wire and central axis of piston
t=360; %Number of turns
l=5; %Length of wire
F=16; %Applied force(kg) to piston; worst case for 32kg system load
A=0.00002; %Area of force (of cut-outs? solid area? total area?)
%%System Equations
DvDz=DV/DZ; %Velocity Gradient in the z-direction (m/s); motion through MR
T=F/A; %Shear Stress
%Magnetic EQs
B=((u0*a)/(2*pi*r)); %B-field equation; Biot Savart
H=(B/u0); %H-field equation, possibly H=(B/u)-M
%%MR Fluid
T=TyH + n*DvDz; %MR fluid equation; shear stress
%%Plotting
figure
plot(a,B)
xlabel('Current (Amper)')
ylabel('Magnetic Field Intensity (Tesla)')
title('Magnetic Field Intensity as a Function of Electric Current')
figure
[X,Y,Z]=peaks(30) %plaseholder for data
surfc(X,Y,Z)
%surfc(H,DvDz,T) %3D surface for Shear stress as a function of velocity and magnetic field strength
%xlabel('Magnetic Field Intensity')
%ylabel('Velocity Gradient')
%zlabel('Shear Stress of MR Fluid')
  1 个评论
Stephen23
Stephen23 2015-4-10
When you upload a file you have to click two buttons: Choose file and then Attach file. Please edit your question and try uploading it again.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Stress and Strain 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by