How to set a function for error propagation
    5 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Niklas Kurz
 am 21 Jul. 2020
  
    
    
    
    
    Bearbeitet: Niklas Kurz
 am 24 Jul. 2020
            Hey, this is kinda my first try with 
function
My aim is to code an automatic sequence for error propagation. E.g.
function [DeltaY] = equation(x)
With DeltaY being the solution  and x an equation like x = a*b
As I said I have very little experience with functions, hence: 
function [DeltaY] = equation(x)
DeltaY = sqrt((diff x,a)^2 * da^2 + (diff x,b)^2 * db^2)
end
does not work if I typ
equation(x)
Strikes me as I need to define a b da db seperately  like 
syms a b da db
x = a*b
But where to put it? 
0 Kommentare
Akzeptierte Antwort
  SAA
      
 am 21 Jul. 2020
        Yes you need to deinfe a b da and db either in the function or in your script before you call the function and also let them be inputs to your function
like this:
function [DeltaY] = equation(x,a,b,da,db)
DeltaY = sqrt((diff x,a)^2 * da^2 + (diff x,b)^2 * db^2)
end
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
			
	Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!