'Out of memory error in matlab, how can I solve it?

MATLAB displays the error in TRmatlab1 (line 172)

f1=1./(19.42.*(1./t)+1./((1./2)+sqrt((1./4)-(1.918./(40.^2)).*t)));

My goal is to fit the ambiguous data with a piecewise function f1 and f2:

    %data:
    p_2 = [ 0.0210
            0.0180
            0.3280
            1.3720
            1.8330
            1.8780
            2.0400
            2.0670
            2.0400
            0.1460
            0.1450
            0.1450];
        eta=[0.0020
            0.0020
            0.5200
            0.5020
            0.4840
            0.4640
            0.4440
            0.4260
            0.4240
            0.4230];
        figure(1);
        %Messwerttabelle geplottet:
        plot(p_2, eta, '+');
        grid on;
%parameter t:
        t=(0:1:1e8);
%positive root of the piecewise function f1
        f1=1./(19.42.*(1./t)+1./((1./2)+sqrt((1./4)-(1.918./(40.^2)).*t)));
%negative root of the piecewise function f1
        f2=1./(19.42.*(1./t)+1./((1./2)-sqrt((1./4)-(1.918./(40.^2)).*t)));
        hold on;
        plot(f1,f2);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source