Besoin d'aide en MATLAB - Page 2
Répondre à la discussion
Page 2 sur 2 PremièrePremière 2
Affichage des résultats 31 à 36 sur 36

Besoin d'aide en MATLAB



  1. #31
    invitefb40011d

    Re : Besoin d'aide en MATLAB


    ------

    Personne ?...

    -----

  2. #32
    invite88e71a19

    Re : Besoin d'aide en MATLAB

    La reponse est simple (il suffit de chercher avec google) mais je crois que tu doit etudier un peu avant.
    Code:
    function int = simpcomp(a,b,m,fun)
    %
    %	 Formule de Cavalieri-Simpson composite
    %	 (si on pose m=1 on a la formule simple)
    %
    %	 int = simpcomp(a,b,m,fun)
    %
    h=(b-a)/m; 
    x=[a:h/2:b]; 
    dim = max(size(x));
    y=eval(fun); 
    if size(y)==1, 
       y=diag(ones(dim))*y; 
    end 
    int=(h/6)*(y(1)+2*sum(y(3:2:2*m-1))+4*sum(y(2:2:2*m))+y(2*m+1));
    Quand tu a compris ça tu peux essayer avec les autres formules d'interation.

  3. #33
    invitefb40011d

    Re : Besoin d'aide en MATLAB

    MERCI beaucoup gloria !

  4. #34
    invitec2cefd52

    Re : Besoin d'aide en MATLAB

    Salut a tous

    je pense que cette méthode ne contient aucune boucle
    essaye ce script
    Code:
    a=input('Donnez la valeur A: ');
    b=input('Donnez la valeur B: ');
    P=input('Donnez la fonction comme [A B C]pour ax^2+bx+c: ');
    f=inline(P);
    S=((b-a)/6)*(polyval(P,a)+4*polyval(P,(a+b)/2)+polyval(P,b));
    tu peut voir aussi la fonction suivante

    Code:
    function I = simprule(f_str, a, b, n)
    %SIMPRULE Simpson's rule integration.
    % I = SIMPRULE(F_STR, A, B, N) returns the Simpson's rule approximation
    % for the integral of f(x) from x=A to x=B, using N subintervals, where
    % F_STR is the string representation of f.
    % An error is generated if N is not a positive, even integer.
    
    
    I=0;
    g = inline(f_str);
    h = (b-a)/n;
    
    if((n > 0) && (rem(n,2) == 0))
        I = I + g(a);
    
        for ii = (a+h):2*h:(b-h)
            I = I + 4*g(ii);
        end
       
        for kk = (a+2*h):2*h:(b-2*h)
            I = I + 2*g(kk);
        end
       
        I = I + g(b);
    
        I = I*h/3;
    else
        disp('Incorrect Value for N')
    end

  5. #35
    jojo1968

    Cool Re : Besoin d'aide en MATLAB

    essaye peut être ça :
    Code:
    %%%importation
    TD5=xlsread("Signal sinusoidal S1.xlsx");
    
    %%%vecteur temps
    Temps=linspace(0,length(TD5)/1000,length(TD5))';
    
    %%%vecteur temps + données
    S1(:,1)=Temps;
    S1(:,2)=TD5;
    
    %filtre
    Wn=2*5/1000;
    [a, b]=butter(2,Wn,'low');
    filtre=filtfilt(a,b,S1(:, 2));
    %%%%%%%%%%%%%%%%%%%%%%%%
    figure;
    plot(Temps,filtre);hold on;
    plot(Temps,S1(:,2));
    hold off;
    
    
    %%% détecter les pics négatifs du signal filtrer
    [ind,loc]=findpeaks(filtre);
    
    figure;
    plot(Temps(loc),filtre(loc,1),'o','LineWidth',2);hold on;
    plot(Temps,filtre,'LineWidth',2);hold on;
    plot(Temps,S1(:,2),'LineWidth',2);
    hold off;
    hold off;
    
    %%%% cycle min/max
    Max_Min(1,1)=max(filtre(1:148,1));
    Max_Min(1,2)=min(filtre(1:148,1));
    
    Max_Min(2,1)=max(filtre(148:350,1));
    Max_Min(2,2)=min(filtre(148:350,1));
    
    Max_Min(3,1)=max(filtre(350:550,1));
    Max_Min(3,2)=min(filtre(350:550,1));
    
    Max_Min(4,1)=max(filtre(550:750,1));
    Max_Min(4,2)=min(filtre(550:750,1));
    
    Max_Min(5,1)=max(filtre(750:989,1));
    Max_Min(5,2)=min(filtre(750:989,1));
    
    %%%%% automatisé
    ranges=[1, 148; 148, 350; 350, 550; 550, 750; 750, 989];
    Max_Min1=zeros(size(ranges, 1), 2);
    
    for i = 1:size(ranges, 1);
        Max_Min1(i, 1)=max(filtre(ranges(i, 1):ranges(i, 2), 1));
        Max_Min1(i, 2)=min(filtre(ranges(i, 1):ranges(i, 2), 1));
    end;
    Min=Max_Min1(:,2);
    Max=Max_Min1(:,1);
    
    
    %%%%%%%%%%%%%%%%%%%%%%
    %% Solution prof
    for i=1:length(loc);
        if i==1
            SS=TD5(1:loc(i));
            hold on;
            plot(Temps(1:loc(1)),SS,'k');
            [Val,Ind]=max(SS);
            IMax(i)=Ind;
            VMax(i)=Val;
            plot(Temps(Ind),SS(Ind),'y*','MarkerSize',30);
        else
            SS=TD5(loc(i-1):loc(i));
            [Val,Ind]=max(SS);
            IMax(i)=Ind+loc(i-1)-1;
            VMax(i)=Val;
            hold on;
            plot(Temps(Ind+loc(i-1)-1),TD5(Ind+loc(i-1)-1),'k');
            plot(Temps(Ind+loc(i-1)-1),TD5(Ind+loc(i-1)-1),'y*','MarkerSize',30);
        end;
    end;
    
    AAAAAAAAAAAAAAAAAAAA
    
    S1=xlsread("Signal sinusoidal S1.xlsx");
    
    Temps_1=linspace(0,(length(S1)/1000),length(S1))';
    
    %%% création vecteur temps
    Data_S1(:,1)=Temps_1;
    Data_S1(:,2)=S1;
    
    
    %%% filtre low pass 10Hz
    d1 = designfilt("lowpassiir",FilterOrder=4, ...
        HalfPowerFrequency=0.015,DesignMethod="butter");
    y = filtfilt(d1,Data_S1);
    
    plot(Temps_1,Data_S1(:,2));hold on
    plot(Temps_1,y(:,2))
    hold off;
    
    %nombre de sinusoides
    x=min(y(:,2))
    z=max(y(:,2))
    for i=1:length(y(:,2));
        if y(:,2)==x;
            C(i,1)=1;
        else y(:,2)==z;
            B(i,1)=1;
        end;
    end;
    
    [ind, locs] = findpeaks(-y(:,2));
    plot(Temps_1,locs,"-or","LineWidth",2);hold on    
    plot(Temps_1,y(:,2),"--b","LineWidth",2)
    hold off
    
    % Créez un vecteur de temps (ajustez selon vos besoins)
    Temps_1 = linspace(0, length(y(:,2))/1000, length(y(:,2)));
    
    % Plot
    figure;
    plot(Temps_1, y(:,2), '--b', 'LineWidth', 2); hold on;
    plot(Temps_1(locs), y(locs, 2), '-or', 'LineWidth', 2); hold on
    plot(Temps_1,Data_S1(:,2),'LineWidth',2)
    hold off;
    hold off;
    
    AAAAAAAAAAAAAAAAAAAAAAAAAAAA
    
    function solution=DELTA(a,b,c)
    %UNTITLED7 Summary of this function goes here
    %   Detailed explanation goes here
    Delta=b^2-4*a*c;
    if Delta==0
        disp("unique solution")
        solution=-b/(2*a)
    elseif Delta>0
        disp("deux solutions")
      S1=(-b-sqrt(Delta)/(2*a));
        S2=(-b+sqrt(Delta)/(2*a));
        solution=[S1 S2];
    else Delta<0
        disp("pas de solution")
        solution="vide"; 
    end

  6. #36
    gg0
    Animateur Mathématiques

    Re : Besoin d'aide en MATLAB

    13 ans après ? !!!

Page 2 sur 2 PremièrePremière 2

Discussions similaires

  1. besoin d'aide pour matlab
    Par invite1db4a306 dans le forum Mathématiques du supérieur
    Réponses: 7
    Dernier message: 07/11/2007, 13h05
  2. besoin d'aide en matlab
    Par invitea229b824 dans le forum Mathématiques du supérieur
    Réponses: 0
    Dernier message: 09/01/2007, 09h38
  3. Matlab - besoin d'aide sur la fonction guide
    Par invitecc55914a dans le forum Logiciel - Software - Open Source
    Réponses: 3
    Dernier message: 09/06/2006, 08h32
  4. grand besoin d'aide sur matlab....
    Par invite714cb747 dans le forum Logiciel - Software - Open Source
    Réponses: 5
    Dernier message: 29/11/2004, 13h07