Ignore:
Timestamp:
Mar 13, 2015, 8:19:39 PM (9 years ago)
Author:
sommeria
Message:

bugs corrected in series, transform functions with input parameters introduced, civ/deformation corrected (sign)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/transform_field/diff_vel.m

    r876 r883  
    3535%=======================================================================
    3636
    37 function SubData=diff_vel(Field,XmlData,Field_1)
     37function Field=diff_vel(Field,XmlData,Field_1)
    3838
    39 SubData=Field;
     39%% request input parameters
     40if isfield(Field,'Action') && isfield(Field.Action,'RUN') && isequal(Field.Action.RUN,0)
     41
     42        %default input:
     43        def={'1'};% multiplicative factor for the second velocity field
     44
     45        if isfield(XmlData,'TransformInput')% if parameters have been memorised
     46            if isfield(XmlData.TransformInput,'Factor')
     47                def{1}=num2str(XmlData.TransformInput.Factor);
     48            end
     49        end
     50        num_lines= 1;%numel(prompt);
     51        % open the dialog fig
     52        prompt='enter scale factor for the second field';
     53        answer = inputdlg(prompt,'',num_lines,def);
     54        Field.TransformInput.Factor=str2num(answer{1});
     55    return
     56end
     57Factor=1;
     58if isfield(XmlData,'TransformInput') && isfield(XmlData.TransformInput,'Factor')
     59Factor=XmlData.TransformInput.Factor;
     60end
    4061if exist('Field_1','var')
    4162          F.U=scatteredInterpolant(Field_1.X,Field_1.Y,Field_1.U,'linear');
    42          SubData.U=Field.U-F.U(Field.X,Field.Y);%substract the interpolated ref to U
     63         Field.U=Field.U-Factor*F.U(Field.X,Field.Y);%substract the interpolated ref to U
    4364          F.V=scatteredInterpolant(Field_1.X,Field_1.Y,Field_1.V,'linear');
    44           SubData.V=Field.V-F.V(Field.X,Field.Y);%substract the interpolated ref to V
     65          Field.V=Field.V-Factor*F.V(Field.X,Field.Y);%substract the interpolated ref to V
    4566end
    4667 
Note: See TracChangeset for help on using the changeset viewer.